GridComponent's ColumnDirective is not changed by State.

<div className="data-log-chart-grid">
<GridComponent
ref={ref}
allowPaging={true}
allowSorting={true}
allowMultiSorting={true}
allowReordering={true}
dataSource={dataLogGridSrc}
sortSettings={sortSettings}
height="194"
allowExcelExport={true}>
<ColumnsDirective>
<ColumnDirective key={'DateTime'} field={'DateTime'} headerText={'DateTime'} textAlign={'center'} width="180" />
{dlItemMs.map((o) => (
<ColumnDirective key={o.ITEM_ID} field={`item-${o.ITEM_ID}`} headerText={o.ITEM_NM} textAlign={'center'} type="number" format="N3" width="180" />
))}
ColumnsDirective>
<Inject services={[Sort, Page, ExcelExport]} />
GridComponent>
div>

Component is as above, and the part that does not work as intended is ColumnDirective.



I updated dataLogGridSrc and dlItemMs and expected the Grid to change accordingly, but the data was not displayed.

In the above case, the column header was changed from Steam PT-11 to Vacuum PT-12, but the Grid was not changed. (The chart has been changed.)

Is there a solution to this? Thank you.


Syncfusion Grid version is "@syncfusion/ej2-react-grids": "^19.2.46",


6 Replies 1 reply marked as answer

GJ Gordon Joe February 25, 2022 10:18 AM UTC


(ref.current.columnModel || []).forEach((col, idx) => {
if (idx === 0) return;
try {
const dlItemMsLength = dlItemMs.length;
if (idx - 1 > dlItemMsLength - 1) {
console.error('Grid index out of range compare to DataLog Item Master List!');
return;
}
const itemMsPair = dlItemMs[idx - 1];
const fieldNm = `item-${itemMsPair.ITEM_ID}`;
col.field = fieldNm;
col.foreignKeyField = fieldNm;
col.headerText = itemMsPair.ITEM_NM;
} catch (error) {
fetcher.simpleAlert('There was an error drawing Grid!');
console.error(error);
}
});

I found a temporary solution. ColumnDirective's prop found in the React developer tool was not reflected in GridComponent's column model. Therefore, I matched the values directly on the code first. After that, the refresh method was called to solve the problem.



PS Pavithra Subramaniyam Syncfusion Team February 28, 2022 01:56 PM UTC

Hi Gordon, 

Currently we are validating the scenario ”Grid ColumnDirective is not changed by State” at our side. So will update further details on March 2nd, 2022. Until then we appreciate your patience. 

Regards, 
Pavithra S 



PS Pavithra Subramaniyam Syncfusion Team March 3, 2022 02:17 PM UTC

Hi Gordon, 
 
Thanks for your patience. 
 
We have validated the reported scenario and found this issue occurred while the updated columns length is same as the old columns length in React Grid. So, we have reported this issue to the corresponding team, and they are currently working on this with high priority. So, we will update the validation details within 2 business days(on or before March 7th,  2022). Until then we suggest you use the workaround as you updated. 
 
Regards, 
Pavithra S 



PS Pavithra Subramaniyam Syncfusion Team March 10, 2022 02:21 PM UTC

Hi Gordon,  
  
Thanks for your patience. 

We have confirmed the reported scenario as a bug “onPropertyChange is not triggered while the column length is not same” from our side. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and will include the defect fix in our weekly patch release scheduled to be rolled out by 13th, April 2022. We appreciate your patience until then. 

You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through the below link, 


Regards, 
Pavithra S 


Marked as answer

PS Pavithra Subramaniyam Syncfusion Team May 24, 2022 03:48 AM UTC

Hi Gordon, 


We are dory for the inconvenience.


Due to some internal complexities, we could not include the fix for (“onPropertyChange is not triggered while the column length is not same”) this issue as promised. We are currently working on it with high priority and will include it in our upcoming weekly patch release.


We apologize for the inconvenience caused and appreciate your patience until then.


Regards,

Pavithra S



PS Pavithra Subramaniyam Syncfusion Team May 30, 2022 12:51 PM UTC

Hi Gordon, 


Thanks for your patience.


We are glad to announce that our Essential Javascript2 patch release (v20.1.57) has been rolled out successfully and in that release, we have added the fix for the issue - “onPropertyChange is not triggered while the column length is not same”. So please update your packages to this version to include this fix.


Feedback Link: https://www.syncfusion.com/feedback/33333/onpropertychange-is-not-triggered-while-the-column-length-is-not-same


We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.


Regards,

Pavithra S



Loader.
Up arrow icon