When using Treegrid, I noticed that 3 errors appear
1. If I select a child node of one of the main nodes and then call refreshData(), then the main node itself and all its child nodes are selected
2. If I filter the tree through FilterBar and call refresh Data(), then after it is executed, the tree filtering is reset and the tree shows all nodes
3. If I use selectionProperty="state" on the tree, a warning appears in the debugger console
and TreeGrid_Body does not respond
I have prepared code for testing where these errors can be reproduced.
File to download in DataSource
multilanguageStates.txt
1. If I select a child node of one of the main nodes and then call refreshData(), then the main node itself and all its child nodes are selected
2. If I filter the tree through FilterBar and call refresh Data(), then after it is executed, the tree filtering is reset and the tree shows all nodes
3. If I use selectionProperty="state" on the tree, a warning appears in the debugger console
"ISC_Core.js:1432*08:59:19.958:MMV0:WARN:TreeGridBody:multilanguageList_body:row heights not yet available; returning all zeroes"
I have prepared code for testing where these errors can be reproduced.
Code:
import React, { Component } from 'react';
import { DataSource, DSField, VLayout, Button, TreeGrid, TGField } from 'smartclient-pro/react';
class App extends Component {
constructor(param) {
super(param);
};
transformMultilanguages(dsResponse, dsRequest, data) {
this.setupIDs(dsResponse.data, 1);
return dsResponse;
}
setupIDs(records, id, pid) {
let $id = id;
for (let record of records) {
record.parentId = pid;
record.id = $id;
$id++;
let childs = record.properties;
if (childs != null && childs.length) {
$id = this.setupIDs(childs, $id, $id - 1);
}
}
return $id;
}
onSelectionUpdated(firstRecord, selectedRecords) {
let grid = window.multilanguageList;
let tree = grid.data;
for (let record of selectedRecords) {
record.changed = true;
let parents = tree.getParents(record);
for (let parent of parents) {
parent.changed = true;
}
}
}
refreshData() {
window.multilanguageList.refreshData();
}
render() {
return (
<>
<DataSource ID="multilanguageDS" clientOnly="true"
dataURL="multilanguageStates.txt"
transformResponse={this.transformMultilanguages.bind(this)}
>
<fields>
<DSField name="id" type="integer" primaryKey="true" />
<DSField name="parentId" type="integer" foreignKey="id" />
<DSField name="name" type="text" canFilter="true" />
<DSField name="state" type="boolean" />
<DSField name="istate" type="boolean" />
<DSField name="checkedState" type="integer" />
<DSField name="changed" type="boolean" />
<DSField name="properties" type="any" childrenProperty="true" />
</fields>
</DataSource>
<VLayout membersMargin="5" width="100%" height="100%">
<members>
<Button
title="refresh data"
autoFit="true" showFocused="false"
click={this.refreshData.bind(this)}
/>
<TreeGrid ID="multilanguageList" dataSource="multilanguageDS" autoFetchData="true" loadDataOnDemand="false" keepParentsOnFilter="true" filterOnKeypress="true"
width="100%" height="*" canEdit="false" showFilterEditor="true" showHeader="false" showFolderIcons="false" showNodeIcons="false"
selectionUpdated={this.onSelectionUpdated.bind(this)} selectionAppearance="checkbox" showSelectedStyle="false" cascadeSelection="true" showPartialSelection="true"
>
<fields>
<TGField name="name" escapeHTML="false" />
</fields>
</TreeGrid>
</members>
</VLayout>
</>
);
}
}
export default App;
/*
selectionProperty="state"
*/
multilanguageStates.txt
Comment