首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何修复在free-jqgrid中无法读取未定义的属性“rowIndexes”

如何修复在free-jqgrid中无法读取未定义的属性“rowIndexes”
EN

Stack Overflow用户
提问于 2015-08-11 18:58:12
回答 1查看 434关注 0票数 0

如果通过单击内联编辑或工具栏内联编辑按钮启动内联编辑,则javascript异常。

代码语言:javascript
复制
Column 15TypeError: Cannot read property 'rowIndexes' of undefined  

http://localhost:52216/admin/Scripts/jqgrid-4.9.1/js/jquery.jqgrid.src.js:5135:15

Function.jQuery.extend.each (http://localhost:52216/admin/Scripts/jquery-1.11.2.js:384:23) at jQuery.fn.jQuery.each (http://localhost:52216/admin/Scripts/jquery-1.11.2.js:136:17)

在jgrid.extend.getGridRowById (http://localhost:52216/admin/Scripts/jqgrid-4.9.1/js/jquery.jqgrid.src.js:5133:9)

http://localhost:52216/admin/Scripts/jqgrid-4.9.1/js/jquery.jqgrid.src.js:5498:31

Function.jQuery.extend.each (http://localhost:52216/admin/Scripts/jquery-1.11.2.js:384:23) at jQuery.fn.jQuery.each (http://localhost:52216/admin/Scripts/jquery-1.11.2.js:136:17) at jgrid.extend.setRowData (http://localhost:52216/admin/Scripts/jqgrid-4.9.1/js/jquery.jqgrid.src.js:5495:9)

在$.fn.jqGrid (http://localhost:52216/admin/Scripts/jqgrid-4.9.1/js/jquery.jqgrid.src.js:2003:14)

发生。

异常发生在getGridRowById中

代码语言:javascript
复制
if (this.p.rowIndexes != null)

代码假定这是jqgrid,但在本例中,这是主窗口,因为它是从jquery.jqgrid.src.js中的第2003行调用的。

代码语言:javascript
复制
return fn.apply(this, $.makeArray(arguments).slice(1));

这发生在github的免费jqgrid中,日期为2015-07-24。在以前的版本中没有发生这种情况。怎么修呢?

VS即时窗口的结果:

代码语言:javascript
复制
this
{...}
    [Methods]: {...}
    $grid: {...}
    animationStartTime: 8871.519383290184
    applicationCache: {...}
    autoedit: true
    BASE_URL: "/admin/"
    clientInformation: {...}
    clipboardData: {...}
    closed: false
    console: {...}
    data-mce-expando: 1
    DateTemplate: {...}
    defaultStatus: ""
    devicePixelRatio: 1.0499999523162841
    document: {...}
    doNotTrack: null
    editParams: {...}
    event: {...}
    external: {...}
    firstLoad: false
    formDeletingTemplate: {...}
    frameElement: null
    frames: {...}
    history: {...}
    idsOfSelectedRows: [ANDOMAKS,7]
    indexedDB: {...}
    innerHeight: 728
    innerWidth: 1090
    isColState: true
    isVisible: false
    jQuery11120852751018810201: {...}
    lastSelectedRow: "7"
    length: 0
    localStorage: {...}
    location: {http://localhost:52216/admin/Grid/Index/Klient?_user=admin&_company=1}
    maxConnectionsPerServer: 6
    Message: {...}
    msAnimationStartTime: 8871.519383290184
    msCrypto: {...}
    msIndexedDB: {...}
    myColumnsState: {...}
    myColumnStateName: "Klient.0.colState"
    name: ""
    navigator: {...}
    offscreenBuffering: "auto"
    onabort: null
    onafterprint: null
    onbeforeprint: null
    onbeforeunload: null
    onblur: null
    oncanplay: null
    oncanplaythrough: null
    onchange: null
    onclick: null
    oncontextmenu: null
    ondblclick: null
    ondrag: null
    ondragend: null
    ondragenter: null
    ondragleave: null
    ondragover: null
    ondragstart: null
    ondrop: null
    ondurationchange: null
    onemptied: null
    onended: null
    onfocus: null
    onfocusin: null
    onfocusout: null
    onhashchange: null
    onhelp: null
    oninput: null
    onkeydown: null
    onkeypress: null
    onkeyup: null
    onloadeddata: null
    onloadedmetadata: null
    onloadstart: null
    onmessage: null
    onmousedown: null
    onmouseenter: null
    onmouseleave: null
    onmousemove: null
    onmouseout: null
    onmouseover: null
    onmouseup: null
    onmousewheel: null
    onmsgesturechange: null
    onmsgesturedoubletap: null
    onmsgestureend: null
    onmsgesturehold: null
    onmsgesturestart: null
    onmsgesturetap: null
    onmsinertiastart: null
    onmspointercancel: null
    onmspointerdown: null
    onmspointerenter: null
    onmspointerleave: null
    onmspointermove: null
    onmspointerout: null
    < More... (The first 100 of 158 items were displayed.) >
this.each
undefined
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-08-11 20:11:22

对不起,但是在调用堆栈中可以看到,问题发生在调用您的回调函数的内部的setRowData中,回调函数afterSaveFuncAfterAdd在另一个回调函数aftersavefunc中调用。我想你在堆栈里打错电话了。

我建议您验证aftersavefunc (由fullBoolCallback调用)是否正确地将this初始化为网格的DOM。您必须使用.call.apply来调用任何子函数(例如afterSaveFuncAfterAdd.call(this, otherParameters);)。我想有些电话是没有转发this的。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31949847

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档