Hi All,
I got the problem about the cgridview is not reload when call method $.fn.yiiGridView.update('list_product');
Please help!
Below is the javascript and cgridview page...
I got the problem about the cgridview is not reload when call method $.fn.yiiGridView.update('list_product');
Please help!
Below is the javascript and cgridview page...
<button class="btn" type="button" id="btn_product" value="Product">Product</button> <?php $this->widget('bootstrap.widgets.TbGridView',array( 'type'=>'striped bordered condensed', 'id'=>'list_product', 'dataProvider' => $dataProvider, ... 'columns'=>array( array( 'class' => 'CCheckBoxColumn', 'id'=>'p_col_chkbox', 'selectableRows' => '2', 'header'=>'Selected' ), array( 'name'=> '', 'header'=>'#', ... ), .. )); ?> <script> $("button#btn_product").click(function(e){ //prevent normal action of tag e.preventDefault(); // Get selected items from cgridview - checkbox checked_item_list = $('input[name=\"p_col_chkbox[]\"]:checked'); var list_p_ids = new Array(); for(i = 0; i < checked_item_list.length; i++) { list_p_ids[i] = checked_item_list[i].value; } // Call ajax var request = $.ajax({ url: "<?= Yii::app()->controller->createUrl('updateProduct') ?>", type: "POST", data: {theChkIds:list_p_ids}, dataType: "text", success:function(data) { // Update gridview $.fn.yiiGridView.update('list_product'); }, error:function(data) { alert("failed"); }, }); }); </script>