每当我在任何函数中调用此行时都会出错...
$('#tt').datagrid('getRows').length;
萤火虫错误:
TypeError: $.data(...) is undefined
return $.data(jq[0],"datagrid").data.rows;
我的代码.. test.aspx
<table id="tt" title="DataGrid" tabindex="511" singleselect="true" idfield="Id">
和
function _insertFilter(){
var index = $('#tt').datagrid('getRows').length; // error
var row = $('#tt').datagrid('getEditors', index); //
if (row)
row = [];//error handle by this
if (row.length>0 && !row[0].target.val() && !row[1].target.val()){
} else {
var toAdd = true;
var editors = $('#tt').datagrid('getEditors', ($('#tt').datagrid('getRows').length-1));
if (editors.length>0) {
if (editors[0].target.val() == "" && editors[1].target.val() == "")
toAdd = false;
}
在此之前我用下面的函数初始化我的表
function FilterDataGrid() {
$(function() {
var lastIndex;
$('#tt').datagrid({
title: '',
idField: 'Id',
height: 160,
width: 850,
singleSelect:true,
columns: [[
{ field: 'Id', title: 'Id', hidden: true, width: 60 },
{ field: 'AccountName', title: 'Account', width: 390,
editor:{
type:'text',.....more code //bt here is no problem