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.
@@ -1195,16 +1195,21 @@ var renderMenuItem = function renderMenuItem() {
1195
1195
  function OdsDataGrid(props) {
1196
1196
  var dataGridRef = useRef(null);
1197
1197
  useEffect(function () {
1198
- setTimeout(function () {
1199
- var totalCount = props.dataSource.length;
1200
- if (dataGridRef.current.instance.component !== undefined) {
1201
- debugger;
1202
- dataGridRef.current.instance.component.beginUpdate();
1203
- dataGridRef.current.instance.totalCount(totalCount);
1204
- dataGridRef.current.instance.component.endUpdate();
1198
+ var dataGrid = dataGridRef.current.instance;
1199
+ var fetchData = function fetchData() {
1200
+ try {
1201
+ var totalCount = props.dataSource.length;
1202
+ dataGrid.beginUpdate();
1203
+ dataGrid.totalCount(totalCount);
1204
+ dataGrid.option('dataSource', [].concat(dataGrid.option('dataSource'), props.dataSource));
1205
+ dataGrid.endUpdate();
1206
+ return Promise.resolve();
1207
+ } catch (e) {
1208
+ return Promise.reject(e);
1205
1209
  }
1206
- }, 1000);
1207
- }, [props.dataSource]);
1210
+ };
1211
+ fetchData();
1212
+ }, []);
1208
1213
  return grid(props, dataGridRef);
1209
1214
  }
1210
1215
  function grid(props, dataGridRef) {