所以我已经看过关于这类问题的所有其他问题,我似乎无法找到答案。对不起这里的长代码 - 但有人可以告诉我为什么“删除”命令按钮会突然停止触发?之前它运作得很好。正如你所看到的,我没有附加任何代码 - 它是原生代码。现在,它什么都不做。我在FireBug中观看过一切都没有被解雇。
JQuery和Kendo像往常一样加载 - 按钮显示正常。所有其他按钮都可以正常工作。
似乎无法看出问题是什么......有什么建议吗?这是网格的代码:
function generateGrid() {
$("#teamGrid").kendoGrid({
columns: [
{ title: "First Name",
field: "users_first_name",
attributes: {
style: "text-align: center; font-size: 14px;"
},
filterable: true,
headerAttributes: {
style: "font-weight: bold; font-size: 14px; width: 100px;"
}
},
{ title: "Last Name",
field: "users_last_name",
attributes: {
style: "text-align: center; font-size: 14px;"
},
filterable: true,
headerAttributes: {
style: "font-weight: bold; font-size: 14px; width: 100px;"
}
},
{ title: "Email",
field: "users_email",
attributes: {
style: "text-align: center; font-size: 14px;"
},
filterable: { extra: false },
headerAttributes: {
style: "font-weight: bold; font-size: 14px; width: 300px;"
}
},
{ title: "User Type",
field: "admin_status",
attributes: {
style: "text-align: center; font-size: 14px;"
},
filterable: true,
headerAttributes: {
style: "font-weight: bold; font-size: 14px; width: 80px;"
},
template: function(dataItem) {
if ( dataItem.admin_status == 0 ) {
return "Team Member";
} else if ( dataItem.admin_status == 1 ) {
return "Admin";
} else if ( dataItem.admin_status == 2 ) {
return "Manager";
} else if ( dataItem.admin_status == 3 ) {
return "Acct Owner";
}
}
},
{
command: [
{
name: "custom1", text: "Edit",
click: function(e) {
$uid = this.dataItem(this.select()).users_id;
$(".title h4").filter(":first").css({
color: "blue",
"text-decoration": "underline",
cursor: "pointer"
});
var offset = $(".grid-box").offset();
var newLeft = offset.left+25;
newLeft = newLeft + "px";
var newTop = offset.top+80;
newTop = newTop + "px";
// Get Profile Info
$.getJSON(
'/data/get_profile_data.php',
{ users_id: $uid })
.done( function(data) {
$("#users_first_name").val(data[0].users_first_name);
$("#users_last_name").val(data[0].users_last_name);
$("#users_email").val(data[0].users_email);
$("#admin_status").val(data[0].admin_status);
$("#rc").val($uid);
$('#teamGrid').css("display","none");
$('.grid-box2').css({
display: "block",
position: "absolute",
top: newTop,
left: newLeft,
});
});
},
},
{
name: "destroy", text: "Delete"
}
],
headerAttributes: {
style: "width: 120px;"
},
attributes: {
style: "text-align: center;"
},
title: " "
}
],
dataSource: {
transport: {
read: {
url: "/data/get_team.php"
},
update: {
url: "/data/update_teammate.php",
type: "POST"
},
destroy: {
url: "/data/delete_teammember.php",
type: "POST"
},
create: {
url: "",
type: "POST"
}
},
schema: {
data: "data",
total: function (result) {
result = result.data || result;
return result.length;
},
model: {
id: "users_id"
}
},
type: "json"
},
pageable: {
refresh: true,
pageSize: 15,
pageSizes: [
15
]
},
sortable: true,
filterable: true,
autoSync: true,
scrollable: false,
selectable: "row",
reorderable: false,
toolbar: [
{ template: kendo.template($("#template").html()) }
]
}); // END: teamGrid
} // END: generateGrid function
提前致谢..
答案 0 :(得分:0)
我不懂PHP。但JS部分应该是类似的。剑道网格倾向于吞下错误,这对开发人员来说是很痛苦的。但是,为什么不在模式之后添加一个小错误处理程序来查找它是什么。我想当你遇到困难时,每件小事都会有所帮助!
schema: {
model: {
id: "ID",
fields: {
ID: { editable: false },
NumberOfLoads: { editable: true, type: "number" },
Hours: { editable: true, type: "number" },
Kilometres: { editable: false },
WaterUsage: { editable: true },
Driver: { editable: true },
Hole: { editable: true }
}
},
errors: "Errors"
},
error: function (e) {
alert(e);
}