javascript - Yii Cgridview update function not working -
i've been working long time , i'm near understanding i'm doing wrong (yii beginner please show patience me).
i have code in view code
echo chtml::dropdownlist('symptomcategory', '', // selected item $data $this->getsymptomcategories(), array( 'id'=>'categoryselectdropdown', 'prompt'=>"select symptom category", )); $this->widget('zii.widgets.grid.cgridview', array( 'id'=>'symptoms-grid', 'selectablerows'=>1, //ability select 1 symptom @ time 'dataprovider'=>$model2->search(), //'htmloptions'=>array('id'=>'symptomsselectgrid'), 'columns'=>array( 'symptomcode', 'title', 'inclusions', 'exclusions', 'symptomcategory', ), )); and js function this:
$('#categoryselectdropdown').change(function() { var symptomcategory = $('#categoryselectdropdown').val(); $('#symptoms-grid').yiigridview('update', { data: symptomcategory.serialize() }); homecoming false; }); i've tried $(this).serialize() too. anyway.
according examples i've found online should work, nope, doesn't update cgridview. $this->getsymptomcategories() returns array of array('a'=>'a','b'=>'b' ect. ect.)
btw creating model2 = new symptoms; within view rendered controller of different model because want utilize selection gridview fill in form of other model. help, documentation (haven't found useful online), advice, ect appreciated. give thanks oyur time
try way of updating yiigridview
$.fn.yiigridview.update('symptoms-grid', { data: $('#symptomcategory').serialize() // form id }); there can many reasons why yiigridview seems not updating, 1 of them ajax request not beingness sent, mutual reason search status logic not correct, or requested action not pass post info model, resulting in same info beingness returned, making not updating.
see if ajax request going server firebug/console etc. if going check if post info right , check model+controller logic right , criteria of cactivedataprovider reflecting search status
javascript php yii
No comments:
Post a Comment