@azrico/reactgrid 1.3.32 → 1.3.33

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.
@@ -123,7 +123,30 @@ function DataGridEventsWrapper(props) {
123
123
  const click_data = _react.default.useRef(null);
124
124
  const [menuAnchorEl, set_menuAnchorEl] = _react.default.useState(null);
125
125
  const [menuRow, set_menuRow] = _react.default.useState(null);
126
- /* --------------------------------- events --------------------------------- */
126
+ /* -------------------------------------------------------------------------- */
127
+ /* refresh functions */
128
+ /* -------------------------------------------------------------------------- */
129
+ const refresh_column = _react.default.useCallback(col => {
130
+ const dt = props.gridRef.current.ungroupedData;
131
+ for (let index = 0; index < dt.length; index++) {
132
+ props.gridRef.current.setItemPropertyAt(index, col, dt[index][col]);
133
+ }
134
+ }, [props.gridRef]);
135
+ const refresh = _react.default.useCallback(() => {
136
+ const dt = props.gridRef.current.ungroupedData;
137
+ for (let index = 0; index < dt.length; index++) {
138
+ props.gridRef.current.setItemAt(index, {}, {
139
+ replace: false
140
+ });
141
+ }
142
+ }, [props.gridRef]);
143
+ _react.default.useEffect(() => {
144
+ props.gridRef.current['refresh'] = refresh;
145
+ props.gridRef.current['refresh_column'] = refresh_column;
146
+ }, [refresh, refresh_column]);
147
+ /* -------------------------------------------------------------------------- */
148
+ /* events */
149
+ /* -------------------------------------------------------------------------- */
127
150
  const onRowClick = _react.default.useCallback((rowProps, event) => {
128
151
  const nowDate = Date.now();
129
152
  const lastclick = click_data.current[(0, _func_grid.get_row_id)(rowProps)];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/reactgrid",
3
- "version": "1.3.32",
3
+ "version": "1.3.33",
4
4
  "main": "dist/index.js",
5
5
  "description": "React Datagrid",
6
6
  "author": "Azrideus <MehrdadTavangar@gmail.com>",
@@ -29,8 +29,8 @@
29
29
  "typescript": "^4.8.4"
30
30
  },
31
31
  "dependencies": {
32
- "@azrico/controls": "^1.5.84",
33
- "@azrico/object": "^1.4.84",
32
+ "@azrico/controls": "^1.5.92",
33
+ "@azrico/object": "^1.4.97",
34
34
  "@emotion/react": "^11.9.3",
35
35
  "@emotion/styled": "^11.9.3",
36
36
  "@inovua/reactdatagrid-enterprise": "^5.10.2",
@@ -274,8 +274,31 @@ function DataGridEventsWrapper(props: DataGridWrapperProps) {
274
274
  const [menuAnchorEl, set_menuAnchorEl] = React.useState<any>(null);
275
275
  const [menuRow, set_menuRow] = React.useState<any>(null);
276
276
 
277
- /* --------------------------------- events --------------------------------- */
278
-
277
+ /* -------------------------------------------------------------------------- */
278
+ /* refresh functions */
279
+ /* -------------------------------------------------------------------------- */
280
+ const refresh_column = React.useCallback(
281
+ (col: string) => {
282
+ const dt = props.gridRef.current.ungroupedData;
283
+ for (let index = 0; index < dt.length; index++) {
284
+ (props.gridRef.current as any).setItemPropertyAt(index, col, dt[index][col]);
285
+ }
286
+ },
287
+ [props.gridRef]
288
+ );
289
+ const refresh = React.useCallback(() => {
290
+ const dt = props.gridRef.current.ungroupedData;
291
+ for (let index = 0; index < dt.length; index++) {
292
+ (props.gridRef.current as any).setItemAt(index, {}, { replace: false });
293
+ }
294
+ }, [props.gridRef]);
295
+ React.useEffect(() => {
296
+ props.gridRef.current['refresh'] = refresh;
297
+ props.gridRef.current['refresh_column'] = refresh_column;
298
+ }, [refresh, refresh_column]);
299
+ /* -------------------------------------------------------------------------- */
300
+ /* events */
301
+ /* -------------------------------------------------------------------------- */
279
302
  const onRowClick = React.useCallback(
280
303
  (rowProps, event) => {
281
304
  const nowDate = Date.now();