defaultSort column doesn't change when reseting columns displayed and setting the defaultSort value on a different column
See original GitHub issueDescribe the bug defaultSort column doesn’t change when reseting columns displayed and setting the defaultSort value on a different column
To Reproduce Create a data source and multiple columns views of that data Change the columns view, expected the following:
- Columns displayed are changed ==> YES
- Column options, e.g., colors and filtering, are updated ==> YES
- Column defaultSort is updated ==> NO
Expected behavior Expected the defaultSort to change along with the other column options.
Material-Table Version
- Version: “material-table”: “^1.39.0”
Additional context I solved this by creating separate components (unique JS files) and passing the columns, options, data, etc. to the individual components, but … since all other column settings are changing, wanted to ask about this value getting updated as well.
Screen Shots
Initial Set of Columns, with the 7th column sorted
Switch to a new “VIEW” (set of columns with associated options)
defaultSort stays on 7th column, instead of switching to the 9th column (“Bonus Rate”), see code below for view of the column attribute.
{ title: "Tech Falls", field: "tech_falls", filtering: false, headerStyle: { backgroundColor: "#008080", color: "#FFF", }, }, { title: "Falls", field: "fall_total", filtering: false, headerStyle: { backgroundColor: "#008080", color: "#FFF", }, }, { title: "Bonus Rate", field: "bonus_predictor", filtering: false, defaultSort: "desc", headerStyle: { backgroundColor: "#008080", color: "#FFF", }, }, ]
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Hi @gxwheel152 Thanks for clear issue. I will take a look at this asap.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.