'status' => array(
'label'=>"<i class='fa fa-eye-slash'></i>", // text label of the button
'url'=>function ($data)
{
return $this->createUrl("counters/changeStatus",array('id'=>$data->counter_id, "status"=>$data->status ? 0 : 1 ));
}, // a PHP expression for generating the URL of the button
'imageUrl'=>false, // image URL of the button. If not set or fa lse, a text link is used
'options'=>array(
'class'=>'btn roundPoint4 btn-xs green btn-warning statusBtn',
'title'=>"Activate/Deactivate",
), // HTML options for the button tag
'click'=>'function(e){
e.preventDefault();
//open confirmation box write ur code here
}', // a JS function to be invoked when the button is clicked
'visible'=>function ()
{
return true;
}, // a PHP expression for determining whether the button is visible
),
现在我向你展示我在我的代码中为你想做的事情做了什么
'status' => array(
'label'=>"<i class='fa fa-eye-slash'></i>", // text label of the button
'url'=>function ($data)
{
return $this->createUrl("counters/changeStatus",array('id'=>$data->counter_id, "status"=>$data->status ? 0 : 1 ));
}, // a PHP expression for generating the URL of the button
'imageUrl'=>false, // image URL of the button. If not set or fa lse, a text link is used
'options'=>array(
'class'=>'btn roundPoint4 btn-xs green btn-warning statusBtn',
'title'=>"Activate/Deactivate",
), // HTML options for the button tag
'click'=>'function(e){
e.preventDefault();
$(this).parents("table").find("tr.workingRowClass").removeClass("workingRowClass");
$("#secretForm").html("");
var parts = getMyIdNew($(this).attr("href"), "/status/", "/id/") ;
setAction($("#secretForm"), "POST", parts[2], 1)
moslakeFormInput( $("#secretForm") , "Counters[id]", "hidden", parts[1] , "id");
moslakeFormInput( $("#secretForm") , "Counters[status]", "hidden", parts[0], "status");
moslakeFormInput( $("#secretForm") , "operation", "hidden", "statusChange", "operation");
$("#promptAlert").find(".modal-body").html("<p>Are you sure you want to change status of the this Item ?</p>");
$("#promptAlert").modal("show"); $(this).parents("table").find("tr").removeClass("deleteMode");
$(this).parents("tr").addClass("workingRowClass");
}', // a JS function to be invoked when the button is clicked
'visible'=>function ()
{
return true;
}, // a PHP expression for determining whether the button is visible
),
我有复制粘贴代码。所以这将是额外的。当有人点击“状态”按钮时。它将打开引导模式。并要求确认。在执行此操作时,我创建了一个带有操作和一些字段的表单。在那个模式中我有继续按钮。在继续按钮上单击表单将被提交。关闭时,表格将变为空。表格将显示无表格。并且将隐藏所有字段..我知道它比 urs 更复杂......但我用 post 来做......但你可以将你的 HREF 分配给这个函数中的 POST 按钮链接,然后点击它会是重定向