Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
155
Restore grid's state causing columns lost their customized template in v17, but not in v18
posted

HI:

   As per the title/subject,

in v17, sample stackblitz here:

https://stackblitz.com/edit/xusebhfz-wvhbp2bx?file=src%2Fapp%2Fgrid%2Fgrid-sample-right-pinning%2Fgrid-right-pinning.component.html,src%2Fapp%2Fgrid%2Fgrid-sample-right-pinning%2Fgrid-right-pinning.component.ts

steps to reproduce:

1) load the page

2) change the customed column, by pinning it

3) click the "save state" and can see it's saved to session state in devtool.

4) click reload/refresh button of stackblitz

5) verify its session state still in devtool.

6) click "restore state".

7) all customized columns lost their customized template.

in v18, sample stackblitz here:

https://stackblitz.com/edit/q2zkrdvm-qw8okx57?file=src%2Fapp%2Fgrid%2Fgrid-add-row-sample%2Fgrid-add-row-sample.component.html,src%2Fapp%2Fgrid%2Fgrid-add-row-sample%2Fgrid-add-row-sample.component.ts,src%2Fapp%2Fdata%2FnwindData.ts

steps to reproduce:

1) load the page

2) change the customed column, by pinning it

3) click the "save state" and can see it's saved to session state in devtool.

4) click reload/refresh button of stackblitz

5) verify its session state still in devtool.

6) click "restore state".

7) all customized columns retain their customized template.

(actually we no need to reload to see, just click "save state" and "restore state" will do)

Could it be related to "IGridStateOptions" ? 

I suspect it's similar to this:

www.infragistics.com/.../restoring-state-of-grid-columns-seems-to-ignore-html-template

  • 800
    Verified Answer
    Offline posted

    Hello,

    Thank you for posting in our community!

    I have been looking into your question, and what I can say is that the reason the templates are not restored in the first sample that uses igniteui-angular@17.2.27, but are restored in the second sample that uses igniteui-angular@18.2.13, is that a new feature of the igxGridState directive has been introduced in version 18.2.0, as mentioned in our Changelog here:

    When possible, the state directive now reuses the column that already exists on the grid when restoring the state, instead of creating new column instances every time. This removes the need to set any complex objects manually back on the column on columnInit.

    Please let me know if you need any further information regarding this matter.

    Sincerely,
    Riva Ivanova
    Software Developer