Yii Framework Forum: Fn.yiigridview.update, Update Partial - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Fn.yiigridview.update, Update Partial Rate Topic: -----

#1 User is offline   nath-0 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 81
  • Joined: 12-October 12
  • Location:switzerland

Posted 11 January 2013 - 05:30 AM

hello,

I am using
$.fn.yiiGridView.update("tprojets-grid", {data: $(this).serialize() })


But I would like to update the whole grid expect the first row.
How I can do that?

is it possible to do something after the grid has been updated complety ?

Nath
0

#2 User is offline   Keith 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,451
  • Joined: 04-March 10
  • Location:UK

Posted 11 January 2013 - 03:31 PM

You can specify javascript callbacks in the beforeAjaxUpdate and afterAjaxUpdate properties. The afterAjaxUpdate callback is fired after the grid is updated with the new data.
0

#3 User is offline   nath-0 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 81
  • Joined: 12-October 12
  • Location:switzerland

Posted 14 January 2013 - 05:33 AM

afterAjaxUpdate doesn't work for my issue.

I extends my gridView. I add a row to create a new row and I would like to keep the value for the next insert.

I attach a exemple with what I am trying to do.

code of my submit boutton :

                           echo CHtml::ajaxSubmitButton('Ajouter', $this->getController()->createUrl('/TRapportsActivites/Create'), array(
                                    'type' => 'POST',
                                    'dataType' => 'json',
                                    'data' => 'js:$("#TRapportsActivites").serialize()',
                                    'success' => 'js:function(data){ 
                                         if(data.resultat==="Ok"){
                                             $("#msgError").html("");
                                             $.fn.yiiGridView.update("tprojets-grid", {
                                                data: $(this).serialize() 
//                                              success :function(data){alert($("#dateAdd").val()});
//                                               
                                            }); 
                                         }else{
                                          $("#msgError").empty(); 
                                          $("#msgError").append(data.msg);
                                         }
                                     }',
                                      ));
 

0

#4 User is offline   nath-0 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 81
  • Joined: 12-October 12
  • Location:switzerland

Posted 14 January 2013 - 05:49 AM

I find the solution :

$.fn.yiiGridView.update("tprojets-grid", {
        data: $(this).serialize(),
        complete: function(jqXHR, status) {
            if (status=="success"){
                $("#dateAdd").val(data.date);
            }
        }
        
    });

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users