This is a migrated thread and some comments may be shown as answers.

expanded column width

1 Answer 148 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
TREXIMA spol. s r.o.
Top achievements
Rank 1
TREXIMA spol. s r.o. asked on 22 Feb 2019, 02:01 PM

Hello,

  I try remember column width if user changed column size and recover if return to page back. OnColumnResize event is fine, but if user change expand column (index 0), I am not able to recover width of column "expanded" (which is autogenerated ...) ?

  Thank you Pavel

 

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 25 Feb 2019, 11:46 AM
Hello,

This is expected as we return only the user created columns in the event, as otherwise this will add a new column to the collection and duplicate it.

I understand that this is a valid case which is currently not working, I can suggest the following approach. Add the custom expand/collapse column which will be part of the columns collection. As we already have the component for that cell exposed, it can be reused to save the time to write the column manually:

<Column
  cell={GridHierarchyCell} // can be imported from "@progress/kendo-react-grid"
  width={32}
  resizable={true}
  field="myField"
  title=" "
/>

Then handle the expand and collapse on the onItemChange event instead of the onExpandChange event:

expandChange = (event) => {
  event.dataItem.expanded = !event.dataItem.expanded;
  event.dataItem.myField = event.dataItem.expanded;
  this.forceUpdate();
}

This is an example demonstrating this:

https://stackblitz.com/edit/react-sr6wfc-efev4q?file=app/main.js

I will also create a property to improve this approach:

https://github.com/telerik/kendo-react/issues/197

Regards,
Stefan
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
TREXIMA spol. s r.o.
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or