Custom Renderer for a column resets the filter that is applied to the handsontable

Tags: #<Tag:0x00007f8b24095d60> #<Tag:0x00007f8b24095ae0>

image

The code is the portion to create a render button that sets the props called styleId to another page with a different handsontable, when I select a button, it resets the handsontable. The main page gets data for a model using Azure function, the other page contains a model that has this model’s id as parameter. Any suggestions on how to resolve this will be appreciated.

The data is received using redux. The renderer is being set using the format below
<HotTable
ref={hotTableObjectStyleRef}
columns={[
{ data: ‘Name’ },
{ renderer: hasStyleParameterRenderer },
{ data: ‘Description’ },
{ data: ‘RoleId’, type: ‘dropdown’, source: roles.map((type) => type.Id), validator: ‘dropdown’ },
{
data: ‘ObjectCodeId’,
type: ‘dropdown’,
source: objectCodes.map((type) => type.Id),
validator: ‘dropdown’,
},
{ data: ‘StateId’, type: ‘dropdown’, source: states.map((type) => type.Id), validator: ‘dropdown’ },
{
data: ‘MajorCodeId’,
type: ‘dropdown’,
source: majorCodes.map((type) => type.Id),
validator: ‘dropdown’,
},
{
data: ‘Minor1CodeId’,
type: ‘dropdown’,
source: minor1Codes.map((type) => type.Id),
validator: ‘dropdown’,
},
{
data: ‘Minor2CodeId’,
type: ‘dropdown’,
source: minor2Codes.map((type) => type.Id),
validator: ‘dropdown’,
},
{
data: ‘Minor3CodeId’,
type: ‘dropdown’,
source: minor3Codes.map((type) => type.Id),
validator: ‘dropdown’,
},
{
renderer(instance, TD, row, col, prop, value, cellProperties) {
//filter objectStyles, as it would have all the object styles. we need only for the current standard.
var filteredStyles = objectStyles.filter((objectStyle) => {
if (objectStyle.StandardId === standardId) {
return true;
}
return false;
});
if (filteredStyles[row]) {
const item = filteredStyles[row];
const name = item.ModifiedBy?.split(’@’)[0];
const date = item.LastModified?.toLocaleString().slice(0, 10);
value = ${name} - ${date};
TD.innerText = value;
}
return TD;
},
readOnly: true,
},
{ data: ‘Id’ },
]}

The issue seems to have propped up in this one but couldn’t find a resolution
Previous article with the same issue

Hi @ramudarna007_handson

Thank you for contacting us. Can you please send us a code demo representing the issue? It should minified to the point where the problem is replicable, as that would help us to determine more quickly what might be causing the issue.

How should I prepare the code demo, is it fine to show a recording?

Hi @ramudarna007_handson

You can use a sandbox of your choice: jsFiddle, CodeSandbox or StackBlitz. Video recording won’t be enough in more complex cases like this.

I am using redux to get the data from a database, does using a dummy data behave the same while using handsontable and are there any changes that need to be made to make sure that data is correct

Hi @ramudarna007_handson

If you change only the data set, it shouldn’t change anything. You’ll see while recreating the issue, if there are any changes in the behavior.