Ajax update from gridview

Hi,

I’m currently using yiibooster to have a togglecolumn on one of my columns in the gridview.

This allows me to update a user to checked in on the fly and it updates instantly

The issue I’m having is when this is clicked, I want the div containing the current number of users checked in to update and run the code again so we have a real time update of how many people are checking in and to show that the system is updating.

Looking into the model for the capacity. This piece of code sits OUTSIDE my gridview.


echo '<div id="summary">';

// echo CJSON::encode(EventAttendees::model()->getCapacity());

echo EventAttendees::model()->getCapacity();

echo '</div>';

And my gridview column. I have attempted to update the javascript after the toggle but no luck at all with this.




array(

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

            'filter' => EventAttendees::getCheckinStatusList(),

            'toggleAction' => 'eventAttend/toggle',

            'name' => 'checkin_status_id',

            'checkedButtonLabel' => 'Checked In',

            'uncheckedButtonLabel' => 'Not Checked In',

            'displayText' => true,

            'afterToggle' => array(

                        'type' => 'GET', 

                        'url' => CController::createUrl('UpdateAjax'),

                        'data'=> array('data'=>'js:function(data) {  jQuery.ajax("#summary").append(jQuery.load("<?php echo EventAttendees::model()->getCapacity(); ?>"));

                                $("#summary").val("");

                        },'),  

                        'update'=>'#summary',

                       ),

            'htmlOptions' => array(

                'class' => 'toggle-column displayText',

            )

        ),       

Never used TbToggleColumn but shouldn’t “afterToggle” be a function (in string form), instead of an array?

http://yiibooster.clevertech.biz/api/classes/TbToggleColumn.html#property_afterToggle

No idea how it works as I can’t find any examples, I assume I need an aftertoggle or an ontoggle to update the div so I can get the updated number of people who have checked in rather tahn having to refresh the page,

www.viewersfacts.com/pura-bella