I have participants that make contributions that are split by percents. John has $100 that is split 50%, 50% so it would be $50, $50. Mary has $100 split 40%, 40%, 20% so $40, $40, $20. Sometimes the rounding isn’t so tidy. Sometimes $100 is $99.999. They are also asking for a Confirm screen. So the confirm screen displays 33.33, 33.33, 33.33 and gives the option of changing anyone of them to 33.34.
My actionCreate takes the $_POST data from the create form, does some math and calls a confirm screen
$dp[] = array('participant_name' => $participant->participant_name, 'amount' => $model->amount,
'ticker' => $p['ticker'], 'current' => $p['shares'],
'added' => $shares, 'confirm' => $p['add']);
$dataProvider = new CArrayDataProvider($dp, array(
'keyField' => false,
'pagination' => array('pageSize' => 30,),
));
$this->redirect($this->render('confirm', array('dataProvider' => $dataProvider, 'post' => $_POST)));
Which has a column
array(
'class' => 'booster.widgets.TbEditableColumn',
'name' => 'confirm',
'header' => 'Contribution Dollars',
'value' => function ($data) { return '$ ' . number_format($data["confirm"], 2); },
'htmlOptions' => array('width' => '90px', 'style' => 'text-align:right;'),
'sortable' => false,
'editable' => array(
// 'type'=>'text',
'url' => $this->createUrl('contribution/editableSaver'),
'placement' => 'right',
'inputclass' => 'span3',
),
),
$post["yt0"]="yes";
$_POST=$post;
echo CHtml::ajaxSubmitButton('Yes, this is correct', $this->createAbsoluteUrl('contribution/create', array('id'=>$id, 'yes'=>'yes')),
array('dataType' => 'json',
'type' => 'post',
'data' => $post,
'complete' => 'js:function(){window.location="index.php?r=contribution/create"}',
array('name' => 'yes')));
echo "<p>";
$post["yt0"]="no";
$_POST=$post;
echo CHtml::button('No', array( 'submit'=>array('contribution/create', 'id'=>$id ), ) );
Which looks great but doesn’t work. It beautifully modifies the field but is built for updating a model. Yes I know it is the wrong tool. I am asking if there is a right tool. TbEditable says it works without a model but is only one field. I may have X fields. I thought I could be sneaky and do something like
'url' => $this->createUrl('contribution/editableSaver&ticker='.$data['ticker']),
and then use session variables to pass any edits.
So does anyone have a way of having an editable column in a gridview that passes it back to the action that called it?