Hi,
I'm hitting some hard to reproduce "TypeError: records is undefined" error when I filter data in grouped ListGrid. Sometimes it fires every time, sometimes I can do twenty tests and get no error - looks like some race condition when restoring selection in filtered results.
DataSource:
ListGrid properties:
which results in selection by checkbox, with possibility to check entire result set and entire groups. Now, when I have some selection, and enter a filter in filterEditor, SmartClient sometimes throws an error from updateCheckboxHeaderState: TypeError: records is undefined. This doesn't happen when filterOnKeypress is disabled, or when initialCriteria matches all data from my dataSource.
I added some logging, and filtering causes multiple calls to updateCheckboxHeaderState, some of which sometimes fail.
1. Caught on Chrome and Firefox, same stack:
2. Caught on Firefox
Tested in: Chrome 49, Firefox 45.
I'm hitting some hard to reproduce "TypeError: records is undefined" error when I filter data in grouped ListGrid. Sometimes it fires every time, sometimes I can do twenty tests and get no error - looks like some race condition when restoring selection in filtered results.
DataSource:
Code:
ds = isc.DataSource.create
ID: "test#{@objectCategory}DS"
clientOnly: true
fields: [
{name: "groupingKey", hidden: true, primaryKey: true},
{name: "objectCategory", hidden: true},
{name: "objectSubCategory", hidden: true},
{name: "objectSubCategoryName", hidden: true},
{name: "field", hidden: true, primaryKey: true},
{name: "param", title: "Parameter", canEdit: false},
{name: "exported", type: "boolean", canEdit: true}
]
Code:
selectionType: "simple",
selectionAppearance: "checkbox",
canSelectAll: true,
canSelectGroups: true,
showFilterEditor: true,
filterOnKeypress: true,
initialCriteria: {objectCategory: "Cells2g"},
autoFetchData: true,
dataSource: ds // clientOnly datasource
I added some logging, and filtering causes multiple calls to updateCheckboxHeaderState, some of which sometimes fail.
1. Caught on Chrome and Firefox, same stack:
Code:
*13:14:49.411:TMR2:WARN:Log:TypeError: records is undefined
Stack from error.stack:
updateCheckboxHeaderState(<no args: exited>) on [ListGrid ID:exportParamsGridCells2g] @ ISC_Grids.js:60896:48
updateRowSelection(<no args: exited>) on [GridBody ID:exportParamsGridCells2g_body] @ ISC_Grids.js:20277:20
_rowSelectionChanged(<no args: exited>) on [GridBody ID:exportParamsGridCells2g_body] @ ISC_Grids.js:16681:10
_setSelectedObservation(<no args: exited>) on [GridBody ID:exportParamsGridCells2g_body] @ ISC_Grids.js:16649:14
<anonymous>(<no args: exited>) on [GridBody ID:exportParamsGridCells2g_body] @ ISC_Grids.js:16601:18
observation(<no args: exited>) on [Selection ID:exportParamsGridCells2g_selection] @ ISC_Core.js:7495:28
setSelected(<no args: exited>) on [Selection ID:exportParamsGridCells2g_selection] @ ISC_Grids.js:7053:26
observation(<no args: exited>) on [Selection ID:exportParamsGridCells2g_selection] @ ISC_Core.js:7468:68
selectList(<no args: exited>) on [Selection ID:exportParamsGridCells2g_selection] @ ISC_Grids.js:7252:27
setSelectedState(<no args: exited>) on [ListGrid ID:exportParamsGridCells2g] @ ISC_Grids.js:36148:28
setData(<no args: exited>) on [ListGrid ID:exportParamsGridCells2g] @ ISC_Grids.js:31965:14
filterWithCriteria(<no args: exited>) on [ListGrid ID:exportParamsGridCells2g] @ ISC_Core.js:80478:10
_filter(<no args: exited>) on [ListGrid ID:exportParamsGridCells2g] @ ISC_Core.js:80446:10
invokeSuper(<no args: exited>) on [ListGrid ID:exportParamsGridCells2g] @ ISC_Core.js:6567:44
Super(<no args: exited>) on [ListGrid ID:exportParamsGridCells2g] @ ISC_Core.js:6385:21
_filter(<no args: exited>) on [ListGrid ID:exportParamsGridCells2g] @ ISC_Grids.js:52047:17
filterData(<no args: exited>) on [ListGrid ID:exportParamsGridCells2g] @ ISC_Core.js:79955:10
handleFilterEditorSubmit(<no args: exited>) on [ListGrid ID:exportParamsGridCells2g] @ ISC_Grids.js:46894:10
fireCallback(callback=>Obj, argNames=>null, args=>null, target=>[RecordEditor ID:exportParamsGridCells2g_filterEditor], catchErrors=>undef) on [Class Class] @ ISC_Core.js:6812:36
_fireActionsOnPause() on [Class Class] @ ISC_Core.js:6943:26
fireCallback(<no args: recursion>) on [Class Timer] @ ISC_Core.js:6812:36
_fireTimeout(ID=>"_timeout458", tmrID=>465, delayedTmrID=>undef) on [Class Timer] @ ISC_Core.js:33354:10
<anonymous>() @ ISC_Core.js:33276:19
Call stack gathered from within updateCheckboxHeaderState:
ListGrid.updateCheckboxHeaderState()
GridBody.updateRowSelection(rowNum=>0)
GridRenderer._rowSelectionChanged(record=>Obj, state=>true, cascadeSyncOnly=>false)
GridRenderer._setSelectedObservation(selection=>[Selection ID:exportParamsGridCells2g_selection])
anonymous(item=>Obj, newState=>true, cascadingDirection=>"up", recalculate=>undef)
setSelectedObservation(Obj, true, "up")
Selection.setSelected(item=>Obj, newState=>true, cascadingDirection=>undef, recalculate=>undef)
** recursed on setSelectedObservation
Code:
*13:21:52.117:TMR7:WARN:Log:TypeError: records is undefined
Stack from error.stack:
.updateCheckboxHeaderState() @ isomorphic/system/modules-debug/ISC_Grids.js?isc_version=v10.1p_2016-04-11.js:60896:25
.fireCallback() @ isomorphic/system/modules-debug/ISC_Core.js?isc_version=v10.1p_2016-04-11.js:6809:25
._fireActionsOnPause() @ isomorphic/system/modules-debug/ISC_Core.js?isc_version=v10.1p_2016-04-11.js:6943:21
.fireCallback() @ isomorphic/system/modules-debug/ISC_Core.js?isc_version=v10.1p_2016-04-11.js:6809:25
._fireTimeout() @ isomorphic/system/modules-debug/ISC_Core.js?isc_version=v10.1p_2016-04-11.js:33354:5
.setTimeout/tmrID<() @ isomorphic/system/modules-debug/ISC_Core.js?isc_version=v10.1p_2016-04-11.js:33276:9
Call stack gathered from within updateCheckboxHeaderState:
ListGrid.updateCheckboxHeaderState()
[c]Class.fireCallback(callback=>"updateCheckboxHeaderState", argNames=>null, args=>null, target=>[ListGrid ID:exportParamsGridCells2g], catchErrors=>undef)
[c]Class._fireActionsOnPause()
** recursed on [c]Class.fireCallback
Comment