我正在尝试使用phpgrid作为管理编辑界面。我正在处理的表是用来存储历史值的。所以在这个例子中,我有一个学校,它有一个日期时间,用于何时创建和何时过期。PHPgrid处理CRUD服务,但是我不希望它删除记录,而是希望它用当前的日期和时间更新结束日期。
有人知道如何用PHPGrid来做这件事吗?
发布于 2014-01-16 15:51:45
为此,我添加了一个loadComplete函数,该函数为delete按钮取消了对单击事件的绑定,然后添加了自己的事件函数和ajax调用。不太理想,但有效。
$onGridLoadComplete = <<<ONGRIDLOADCOMPLETE
function(status, rowid)
{
$("#del_school").unbind('click');
$("#del_school").click(function(){
if($(".ui-state-highlight").attr("id") != undefined){
if(confirm("Are you sure you want to delete this record?")){
var id = $(".ui-state-highlight").attr("id");
$.ajax({
url: "/phpgrid-ext/index.php?faction=expireSchool&id="+id
}).done(function() {
$("#refresh_school").trigger("click");
});
}
}
else
{
alert("Please select a record to delete.");
}
return false;
});
}
ONGRIDLOADCOMPLETE;
$dg2->add_event("jqGridLoadComplete", $onGridLoadComplete);https://stackoverflow.com/questions/21098457
复制相似问题