jQuery easyui datagrid错误 [英] jquery easyui datagrid Error

查看:80
本文介绍了jQuery easyui datagrid错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

i got error whenever i call this line in my any function...

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

FireBug错误:

FireBug Error:

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

我的代码。.
test.aspx

My Code.. 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;
            }

在此之前,我使用以下函数初始化表

before this i initialize my table with below function

 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 


推荐答案

您在此行中遇到错误:

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

您遇到错误对于此行:

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

尝试

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

//在索引字词上有一个 b但没有一个 n(ibdex )

//there was a "b" and no a "n" on "index" word (ibdex)

这篇关于jQuery easyui datagrid错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆