2013-04-02 77 views

回答

2

您可以cgridview柱陣列的用戶AJAX性能。請找到下面的例子。

array(
     'header'=>'Status', 
     'type'=>'raw', 
     'value'=>'CHtml::CheckBox("$data->active",$data->active,array(
     "ajax" => array(
        "type"=>"POST", 
        "url"=> ApplicationConfig::getURL("user", "twitterFeed", "changeStatus",array("feed_id"=>$data->feed_id)), 
        "dataType"=>"text", 
        "data" => array("ap_programType_id" => $data->feed_id), 
        "success" => "js:function(html){ 
          if(html==\"1\"){ 
           $(\"#active$data->feed_id\").attr(\"checked\",\"checked\"); 
           window.location.reload() 
          } 
           else if(html==\"0\"){ 
           $(\"#active$data->feed_id\").attr(\"checked\",false); 
           window.location.reload() 
          } 

        }", 
        "error"=>"function (xhr, ajaxOptions, thrownError){ 
          alert(xhr.statusText); 
          alert(thrownError);}", 
      ), 
     "style"=>"width:50px;","feed_id"=>$data->feed_id,"id"=>"active".$data->feed_id))', 
     'htmlOptions'=>array("width"=>"50px"), 
    ), 
+0

Neat!..嘿,我想知道如果您可以提供鏈接到文檔?...供將來參考 – kebyang