【问题标题】:jquery easyui datagrid Errorjquery easyui datagrid 错误
【发布时间】:2013-09-24 10:46:09
【问题描述】:

每当我在任何函数中调用此行时都会出错...

$('#tt').datagrid('getRows').length;

FireBug 错误:

TypeError: $.data(...) is undefined
return $.data(jq[0],"datagrid").data.rows;

我的代码.. 测试.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 

【问题讨论】:

    标签: jquery-ui datagrid


    【解决方案1】:

    你得到的错误不是这一行:

    $('#tt').datagrid('getRows').length; 
    

    此行出现错误:

    $('#tt').datagrid('getEditors', index)
    

    试试这个

    var index=$('#tt').datagrid('getRows').length-1;         
    $('#dgItmInfo').datagrid('selectRow', index).datagrid('getEditors', index);
    

    //“索引”字(ibdex)上有一个“b”而没有一个“n”

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-03-19
      • 2014-03-21
      • 2013-11-15
      • 2015-07-28
      • 2013-06-04
      • 2014-03-19
      • 2012-10-06
      • 1970-01-01
      相关资源
      最近更新 更多