I currently have two editable cells in the grid. First one is a dropdown and second is a comment. Depending on the value picked in the dropdown the cell styling for the comment cell changes to show if its required or not. I had this working fine by using below in the select method fired when picking dropdown value (highlight is the cell styling).
// this is needed to ensure the conditions refire on change of valuesthis.highlight = { ...this.highlight };
I found above approach in one of the examples given. This was working fine until I upgraded to 9.1.7 licensed version (from 9.1.2 licenses version) and now its no longer firing the cell styling method for the other columns only for the column which itself changes.
Can you please advise how I can ensure the cell styling is re-evaluated for other columns after changing the contents of one cell.
I can't downgrade back to 9.1.2 as I upgraded to fix another issue with the grid jumping on row selection
Thanks
Katy
Hello Katy,
Thank you for posting in our community.
I have created a small sample in StackBlitz trying to reproduce the described behavior. On my side, when an item that satisfies a given condition is chosen from igxDropDown, the style of the next cell is updated.
If this is not an accurate demonstration of what you are trying to achieve please feel free to fork it, modify it, and send it back to me along with steps to reproduce.
Looking forward to hearing from you.
Yes that is similar to my use case. I figured out the problem is related to the custom toolbar I have around the state service as if I remove that it works fine. What I am doing there is caching the custom styling, functions etc applied to the columns and then reapplying those to the state service output since it drops those. So when user applies a view it will reapply the original functions and handling. Seems like due to that the approach isn't working. Although it definitely did in 9.1.2 as that is currently in production and working fine. I guess the column is already linked to the object rather than the reference and so doing this.highlight = {...this.highlight} isn't impacting those columns. Not too sure how it was working before. Is there a way I can get that to work? Or a different way to ensure the styling is reapplied?
Probably should have mentioned how I am doing the caching to make it clear. First time grid is loaded with the default config it captures the things which are dropped by the state directive
captureTemplates(columns) { columns.forEach(column => { const template = (({ header, formatter, cellClasses, cellStyles, bodyTemplate }) => ({ header, formatter, cellClasses, cellStyles, bodyTemplate }))(column); this.templates.push(template); });}
I then subscribe to the onColumnInit and restore column templates using
restoreColumnTemplates(column) { const columnTemplates = this.templates.find(c => c.header === column.header); if (columnTemplates) { Object.assign(column, columnTemplates); }}
The reason for doing it this way is we already had a lot of logic written into the html for custom templates, formatters, styling etc. So when we wanted to use the state service and found it dropped all those while giving state this was a more generic way to ensure those were kept and reapplied to the view.
I tried to update the stackblitz to show my issue.. so now you will see the initial styling works but when you pick an entry from the select it doesn't update the comment styling. https://stackblitz.com/edit/igxgrid-igxdropdown-conditional-styling-gvdhbn
If you change the comment then the styling does appear so its definitely just an issue with the refresh logic kicking in.
I added a mimic for the state saving (mine actually loads saved views from database but this gives same idea of how its working) and updated the select to be in the cell template since our grid is showing the dropdowns all the time
Hi Katy,
I have reproduced your issue, however, when I tested the scenario in 9.1.2, the same behavior is observed. I have created and attached the sample. Please modify it in order to reproduce the behavior you have in the production environment. This will help me decide how should I proceed further and provide you with better and more accurate support.
1205.Sample.zip
I can't replicate the production behavior now either and we are already using 9.1.7 in production. I think this might have actually been an existing issue but I didn't understand the scenario which was you have to have a view applied for it to not work. I have found a way to workaround which is to ensure the cloned highlight it reapplied as the cellClass for all the columns:
I am glad that you have resolved your issue.
Thank you for using Infragistics components.