[英]what's wrong with the script?
can figure out what's wrong? 可以找出问题所在? always returns failure
总是返回失败
function addItem() {
var rowCount = $('#grid').getGridParam('records');
var lastRow = $('#grid').getRowData(rowCount - 1);
var newRow = lastRow;
newRow.Id = "0";
newRow.Person = "";
newRow.Date = "";
var newItem = $('grid').addRowData(rowCount - 1, newRow);
if (newItem == true) {
alert('success');
}
else { alert('falire'); }
}
I don't know, but perhaps this: 我不知道,但是也许是这样:
var newItem = $('grid').addRowData(rowCount - 1, newRow);
Should be this: 应该是这样的:
var newItem = $('#grid').addRowData(rowCount - 1, newRow); // missing pound sign
-- edit: -编辑:
And if this turns out to be the problem, I suggest you define the names of things at the top, like so: 如果确实是问题所在,建议您在顶部定义事物的名称,如下所示:
var theGridElement = $("#grid");
Thus helping in these little mistakes of minor inconsistency :) 从而帮助解决这些轻微的不一致的小错误:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.