Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use customCell and Reorder in Kendo react Grid at the same time ? #400

Closed
Nassefferjeni opened this issue Nov 28, 2019 · 2 comments
Closed
Labels
Documentation Item which is related to a new article or update of an existing one in our documentation pkg:Grid

Comments

@Nassefferjeni
Copy link

So I am using Kendo React Grid and I am setting the reorder to true and also added a custom cell where I can show/hide columns.

when I don't reorder and try to show/hide everything works fine but when I reorder the columns and then try to hide then restore the column everything will get messy and I can't understand where I can control this.

This is the grid at first.

This is where I reorder the columns

Now I opened the customCell and tried to hide the first column

This is the result where I click on Save the order is changing and I don't know why

this is the Telerik documentation and in all examples there is no one where I can find reorder and customCell at the same time: https://www.telerik.com/kendo-react-ui/components/grid/

And this is the reorder section/ I couldn't find details about customizing the reorder: https://www.telerik.com/kendo-react-ui/components/grid/columns/reordering/

@Xizario
Copy link
Contributor

Xizario commented Nov 29, 2019

If the columns are changed dynamically, each column need to have orderIndex defined, to be placed in the proper place after reordering.
You can use the onColumReorder callback to obtain the proposed orderIndex for each of the columns and store them over your original columns.

There are several possible ways to implement this, depending on what you expect to happen. Here is use case:

Columns: ABCD , user hide B.
Columns: ACD, user then reorder D before A.
Columns DAC. User then show B. Where B should go?

Possible outputs:

  1. DBAC - B shows on its position where it was before hiding.
  2. DABC - B is in the place where it should have been if it was not hidden during the reordering.
  3. BDAC - B shows first
  4. DACB - B shows last.

Personally I prefer second option as it can be implemented for the order the columns in the Column Menu custom cell as well. And the user will know where the column will be even before showing it.

See in your screenshot from step 3, https://i.stack.imgur.com/pJ2TO.png I would expect Description to be above ID in the menu as well.

If this is the desired scenario, let us know and we will add it to the docs.

@Xizario Xizario added Documentation Item which is related to a new article or update of an existing one in our documentation pkg:Grid labels Nov 29, 2019
@Nassefferjeni
Copy link
Author

Thank you for your response. I used the orderIndex and successfully implemented the first output:
DBAC - B shows on its position where it was before hiding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Item which is related to a new article or update of an existing one in our documentation pkg:Grid
Projects
None yet
Development

No branches or pull requests

2 participants