Hey there,
I have a question related to Data Grid.
I'm using mobx to store data for Data Grid, and also the store contains some computed values used by Data Grid Columns.
When I use DataGridColumn component as a direct child of DataGrid it works fine, but when I try to extract the column to separate component, the columns don't render properly.
The code above is simplified, but I hope that it is enough to explain the issue. Is there a way to make it work?
I've figured out that CustomDataGridColumn requires displayName = "KendoReactGridColumn", but it still doesn't work. My guess is that is caused by the observer because it wraps the component with the React.memo.
I have a question related to Data Grid.
I'm using mobx to store data for Data Grid, and also the store contains some computed values used by Data Grid Columns.
When I use DataGridColumn component as a direct child of DataGrid it works fine, but when I try to extract the column to separate component, the columns don't render properly.
import { provider, useInstance } from 'react-ioc';
import { observer } from 'mobx-react-lite';
import { Grid, GridColumn } from '@progress/kendo-react-grid';
import Store from './store';
const CustomDataGridColumn = observer(() => {
const store = useInstance(Store);
return <GridColumn title={`Title (${store.counter})`} />;
});
const CustomDataGrid = observer(({children}) => {
const store = useInstance(Store);
return (
<Grid data={store.data}>
{children}
</Grid>
);
});
const App = provider(Store)(() => (
<CustomDataGrid>
<CustomDataGridColumn />
</CustomDataGrid>
));
The code above is simplified, but I hope that it is enough to explain the issue. Is there a way to make it work?
I've figured out that CustomDataGridColumn requires displayName = "KendoReactGridColumn", but it still doesn't work. My guess is that is caused by the observer because it wraps the component with the React.memo.