javascript - 如何修复无法读取 free-jqgrid 中未定义的属性 'rowIndexes'

标签 javascript jquery jqgrid free-jqgrid

如果通过单击内联编辑或工具栏内联编辑按钮启动内联编辑,则 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 ) 在 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 ) 在 jQuery.fn.jQuery.each ( http://localhost:52216/admin/Scripts/jquery-1.11.2.js:136:17 ) 在 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 行发生异常

if (this.p.rowIndexes != null)

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

return fn.apply(this, $.makeArray(arguments).slice(1));

这发生在来自 github 的免费 jqgrid 中,日期为 2015-07-24。 在以前的版本中不会出现这种情况。 如何解决?

exception

VS 即时窗口的结果:

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

最佳答案

抱歉,但在调用堆栈中看到问题发生在 setRowData在回调函数内部调用 afterSaveFuncAfterAdd它在另一个回调函数内部调用 aftersavefunc 。我想您在堆栈中进行了一些错误的调用。

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

关于javascript - 如何修复无法读取 free-jqgrid 中未定义的属性 'rowIndexes',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31949847/

相关文章:

javascript - 尝试将 jquery .slideDown() 与多个类一起使用

javascript - 仅当组中的另一个键名称匹配时,如何才能从 JSON API 提取键值?

javascript - jqGrid + bootstrap-多选可见性问题

javascript - JQuery 循环(php + sql)

javascript - OnClick 在按下回车键时是否有效?

jQuery Ajax 错误响应包含成功响应

javascript - 在 Ipad Safari 上启用快速(双?)点击

javascript - 将jquery中的日期格式更改为c#日期格式

jquery - 如果滚动到免费 jqgrid 中最右边的位置,如何同步标题和列分隔符行

jqgrid固定高度并填充空行