Andrus
Andrus

Reputation: 27943

How to fix Cannot read property 'rowIndexes' of undefined in free-jqgrid

If inline edit is started by clicking in inline edit or toolbar inline edit button, javascript exception

Column 15TypeError: Cannot read property 'rowIndexes' of undefined  

at http://localhost:52216/admin/Scripts/jqgrid-4.9.1/js/jquery.jqgrid.src.js:5135:15
at 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.getGridRowById (http://localhost:52216/admin/Scripts/jqgrid-4.9.1/js/jquery.jqgrid.src.js:5133:9)
at http://localhost:52216/admin/Scripts/jqgrid-4.9.1/js/jquery.jqgrid.src.js:5498:31
at 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)
at $.fn.jqGrid (http://localhost:52216/admin/Scripts/jqgrid-4.9.1/js/jquery.jqgrid.src.js:2003:14)

occurs.

Exception occurs in getGridRowById at line

if (this.p.rowIndexes != null)

Code assumes that this is jqgrid, but in this case this is main windowsince it is called from line 2003 in jquery.jqgrid.src.js

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

This occurs in free jqgrid from github with date 2015-07-24. It does not occur in previous versions. How to fix it ?

exception

Results from VS immediate window:

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

Upvotes: 0

Views: 510

Answers (1)

Oleg
Oleg

Reputation: 221997

Sorry, but one sees in the call stack that the problem take place in setRowData called inside of you callback function afterSaveFuncAfterAdd which called inside of another callback function aftersavefunc. I suppose that you make some wrong call in the stack.

I recommend you to verify that aftersavefunc (called by fullBoolCallback) have correctly initialized this to the DOM of the grid. You have to use .call or .apply to call any child function (for example afterSaveFuncAfterAdd.call(this, otherParameters);). I suppose that some from the calls was without forwarding this.

Upvotes: 1

Related Questions