@azrico/reactgrid 1.3.33 → 1.3.35

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.
@@ -126,12 +126,12 @@ function DataGridEventsWrapper(props) {
126
126
  /* -------------------------------------------------------------------------- */
127
127
  /* refresh functions */
128
128
  /* -------------------------------------------------------------------------- */
129
- const refresh_column = _react.default.useCallback(col => {
129
+ const refreshColumn = _react.default.useCallback(col => {
130
130
  const dt = props.gridRef.current.ungroupedData;
131
131
  for (let index = 0; index < dt.length; index++) {
132
132
  props.gridRef.current.setItemPropertyAt(index, col, dt[index][col]);
133
133
  }
134
- }, [props.gridRef]);
134
+ }, [props.gridRef.current]);
135
135
  const refresh = _react.default.useCallback(() => {
136
136
  const dt = props.gridRef.current.ungroupedData;
137
137
  for (let index = 0; index < dt.length; index++) {
@@ -139,11 +139,12 @@ function DataGridEventsWrapper(props) {
139
139
  replace: false
140
140
  });
141
141
  }
142
- }, [props.gridRef]);
142
+ }, [props.gridRef.current]);
143
143
  _react.default.useEffect(() => {
144
+ if (!props.gridRef.current) return;
144
145
  props.gridRef.current['refresh'] = refresh;
145
- props.gridRef.current['refresh_column'] = refresh_column;
146
- }, [refresh, refresh_column]);
146
+ props.gridRef.current['refreshColumn'] = refreshColumn;
147
+ }, [props.gridRef.current, props.dataSource, refresh, refreshColumn]);
147
148
  /* -------------------------------------------------------------------------- */
148
149
  /* events */
149
150
  /* -------------------------------------------------------------------------- */
@@ -361,7 +362,7 @@ function DataGridCore(props) {
361
362
  ...props.static_gridOptions,
362
363
  ...props.dynamic_gridOptions,
363
364
  rowIndexColumn: true,
364
- handle: ref => props.gridRef.current = ref ? ref.current : null,
365
+ handle: ref => props.gridRef.current = ref,
365
366
  className: 'azgrid-flexed',
366
367
  columns: props.columns,
367
368
  dataSource: props.dataSource
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/reactgrid",
3
- "version": "1.3.33",
3
+ "version": "1.3.35",
4
4
  "main": "dist/index.js",
5
5
  "description": "React Datagrid",
6
6
  "author": "Azrideus <MehrdadTavangar@gmail.com>",
@@ -277,25 +277,26 @@ function DataGridEventsWrapper(props: DataGridWrapperProps) {
277
277
  /* -------------------------------------------------------------------------- */
278
278
  /* refresh functions */
279
279
  /* -------------------------------------------------------------------------- */
280
- const refresh_column = React.useCallback(
280
+ const refreshColumn = React.useCallback(
281
281
  (col: string) => {
282
282
  const dt = props.gridRef.current.ungroupedData;
283
283
  for (let index = 0; index < dt.length; index++) {
284
284
  (props.gridRef.current as any).setItemPropertyAt(index, col, dt[index][col]);
285
285
  }
286
286
  },
287
- [props.gridRef]
287
+ [props.gridRef.current]
288
288
  );
289
289
  const refresh = React.useCallback(() => {
290
290
  const dt = props.gridRef.current.ungroupedData;
291
291
  for (let index = 0; index < dt.length; index++) {
292
292
  (props.gridRef.current as any).setItemAt(index, {}, { replace: false });
293
293
  }
294
- }, [props.gridRef]);
294
+ }, [props.gridRef.current]);
295
295
  React.useEffect(() => {
296
+ if (!props.gridRef.current) return;
296
297
  props.gridRef.current['refresh'] = refresh;
297
- props.gridRef.current['refresh_column'] = refresh_column;
298
- }, [refresh, refresh_column]);
298
+ props.gridRef.current['refreshColumn'] = refreshColumn;
299
+ }, [props.gridRef.current, props.dataSource, refresh, refreshColumn]);
299
300
  /* -------------------------------------------------------------------------- */
300
301
  /* events */
301
302
  /* -------------------------------------------------------------------------- */
@@ -545,7 +546,7 @@ function DataGridCore(props: DataGridWrapperProps) {
545
546
  {...props.static_gridOptions}
546
547
  {...props.dynamic_gridOptions}
547
548
  rowIndexColumn
548
- handle={(ref) => (props.gridRef.current = ref ? ref.current : null)}
549
+ handle={(ref) => (props.gridRef.current = ref)}
549
550
  className={'azgrid-flexed'}
550
551
  columns={props.columns}
551
552
  dataSource={props.dataSource}