15
Views
2
Comments
[Data Grid Web] Unable to get the contents of the row using the get_checkedRows()
Forge component by OutSystems R&D
41
Published on 14 Dec 2020
Application Type
Traditional Web

Hello,

I'm getting a "TypeError: Cannot read property 'dataItem' of undefined" when I try to retrieve the contents of the row using the get_checkedRows() method after I have applied a sort / filter / navigate to a new page on the grid. 

Also the event is being called twice for some reason. Attaching the stack trace here. 

I understand this issue. It might possibly mean that the elements that I am trying to access are no longer available in the DOM. But how do I get around it?

_osjs.js?11_10_0_22910:5 TypeError: Cannot read property 'dataItem' of undefined

    at GridPanel.getCellData (WijmoGridJS.js?59:14)

    at Object.getCellValue (GridFramework.js?59:8145)

    at getSelectedRowsData (JSIssueTest.js?89:37)

    at eval (eval at <anonymous> (_osjs.js?11_10_0_22910:18), <anonymous>:2:12)

    at eval (<anonymous>)

    at _osjs.js?11_10_0_22910:18

    at Function.globalEval (_osjs.js?11_10_0_22910:18)

    at OsEvaluateUserJavaScript (_osjs.js?11_10_0_22910:5)

    at OsExecuteJSONUpdate (_osjs.js?11_10_0_22910:5)

    at OsJSONUpdate (_osjs.js?11_10_0_22910:5)


Can anyone help me on this issue? Thanks.

Staff
Rank: #52

Hello Shrikant,

Let me see if we can reproduce that problem so we can try to help finding the solution,

Thanks,

Bruno Martinho

Staff
Rank: #566

Hello Shrikant,

Could you explain to me what do you want to achieve? Maybe I can find an alternative for you.

Explaining the code:

  • get_checkedRows: Return the rows selected, line by line, for all grid's pages.
  • getCellData: Return the cell content. There is a trick here, grid will always have lines from 0 to at most pageSize.

Although get_checkedRows could return 1000 rows for you, if your pageSize is set to 50, you can access only 50 of them by getCellData, considering a index from 0 to pageSize.

The index returned by the get_checkedRows seems to be the index on the sourceCollection, and you can access by GridOS.GridObject[0].grid.itemsSource.sourceCollection[<index here>].

Hope I could help you

Ricardo Valim