ods-component-lib 1.17.55 → 1.17.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1199,16 +1199,21 @@ var renderMenuItem = function renderMenuItem() {
1199
1199
  function OdsDataGrid(props) {
1200
1200
  var dataGridRef = React.useRef(null);
1201
1201
  React.useEffect(function () {
1202
- setTimeout(function () {
1203
- var totalCount = props.dataSource.length;
1204
- if (dataGridRef.current.instance.component !== undefined) {
1205
- debugger;
1206
- dataGridRef.current.instance.component.beginUpdate();
1207
- dataGridRef.current.instance.totalCount(totalCount);
1208
- dataGridRef.current.instance.component.endUpdate();
1202
+ var dataGrid = dataGridRef.current.instance;
1203
+ var fetchData = function fetchData() {
1204
+ try {
1205
+ var totalCount = props.dataSource.length;
1206
+ dataGrid.beginUpdate();
1207
+ dataGrid.totalCount(totalCount);
1208
+ dataGrid.option('dataSource', [].concat(dataGrid.option('dataSource'), props.dataSource));
1209
+ dataGrid.endUpdate();
1210
+ return Promise.resolve();
1211
+ } catch (e) {
1212
+ return Promise.reject(e);
1209
1213
  }
1210
- }, 1000);
1211
- }, [props.dataSource]);
1214
+ };
1215
+ fetchData();
1216
+ }, []);
1212
1217
  return grid(props, dataGridRef);
1213
1218
  }
1214
1219
  function grid(props, dataGridRef) {