post process data

Sorry to ask a “do my job for me” question but I can’t find a solution. I have participants who have shares allocated by percentages. The powers that be want them to be able to change their own allocations. TbEditableColumn seemed to be an answer. See code, this works.




<h1>Click on Percentage to Change Percentage </h1>

<h1>Click on Participant to Add a Percentage </h1>

   ...

$this->widget('booster.widgets.TbGroupGridView', array(

    'id' => 'allocate-grid',

    'type' => 'striped bordered condensed',

    'dataProvider' => $dataProvider,

    'mergeColumns' => array('participant_ID'),

    'columns' => array(

       array (

            'name'  =>  'participant_ID',

            'value'=>'CHtml::link(

                      Participant::model()->findByPK($data["participant_ID"])->participant_name,

                     "#", array("onclick"=>\'$("#mydialog").dialog("open"); return false;\',

                                "success" => \'function (){ $.fn.yiiGridView.update("allocate-grid",

                                        {type:"GET", url:$(this).attr("href")}); return false}\',

                     ))',


            'type'  => 'raw',

            'header' => 'Click to add a Percentage',

        ),

        array(

            'name' => 'ticker',

            'header' => 'Ticker',

            'htmlOptions' => array('width' => '70px', 'style' => 'text-align:center')

        ),

        array(

            'class' => 'booster.widgets.TbEditableColumn',

            'name' => 'percentage',

            'header' => 'Percentage',

            'htmlOptions' => array('width' => '90px', 'style' => 'text-align:center'),

            'sortable' => false,

            'editable' => array(

                // 'type'=>'text',

                'url' => $this->createUrl('shares/editableSaver'),

                'placement' => 'right',

                'inputclass' => 'span3',

            ),

        ),

        array(

            'name' => 'shares',

            'header' => 'Shares',

            'htmlOptions' => array('width' => '90px', 'style' => 'text-align:center'),

        ),

    ),

));



The problem is, when they are done, I want the sum of percentages to be 100. The screen to create the original share allocation and percentages shows a running total and is entered by staff, works fine, trained people. This screen will be used by random users changing or playing with their own stuff. Each share/percent is a separate record. Anyone know of a widget that does something like this? Can anyone point me to an example? afterAction? beforeSave?