[ Solved ] Update A Table In Juidialog With Ajax

Hi everyone

First, sorry for my bad english …

I need to add a new record inside a table by clicking a link (or a button) who’s inside a JuiDialogBox but all my attempt have failed. I don’t have anymore idea and don’t find anything with my friend Google.

Does anyone can help me ?

Thank everybody !

Take a look at this and this

Hi,

I think you are using cgridview to display the records from the table,You can use a view button in the Actions Column of the CGridvies and then u can open a cjuidialog to display the particular record of the table and then u can update the table record with respect to the unique id of the respective row using ajax

<?php

in cgridview column:

array(‘header’=>‘update’,‘type’=>‘raw’,‘value’=>CHtml::imageButton(Yii::app()->baseUrl.‘images/update.png’,array(‘onClick’=>‘js:updateTable($data[id])’)); ?>

<script>

function updateTable(id)

{

var row_id = id;

$.ajax(

  array (


           'type'=&gt;'POST',


            'url'=&gt;&quot;&lt;?php Yii::app()-&gt;createUrl('site/update') ?&gt;&quot;,[b]//Here using this controller sction you can update the Particular Row [/b]


             'data'=&gt;{'rowid':row_id},


             'success'=&gt; function(data) {


                  &#036;('#dialog_id').close(); //[b]dialog_id represents the cjuidialog id[/b]


                  &#036;.fn.Yiigridview.update('site_grid');  //[b]site_grid is nothing but the id of the Grid[/b]


               }, 

}

</script>

Thank you guys ! It solves my problem !