question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

defaultSort column doesn't change when reseting columns displayed and setting the defaultSort value on a different column

See original GitHub issue

Describe 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:

  1. Columns displayed are changed ==> YES
  2. Column options, e.g., colors and filtering, are updated ==> YES
  3. 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 2019-06-09_18h59_33

Switch to a new “VIEW” (set of columns with associated options) 2019-06-09_18h59_43

defaultSort stays on 7th column, instead of switching to the 9th column (“Bonus Rate”), see code below for view of the column attribute. 2019-06-09_19h00_02

{ 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:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
mbrncommented, Jun 13, 2019

Hi @gxwheel152 Thanks for clear issue. I will take a look at this asap.

0reactions
stale[bot]commented, Jun 26, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Best way to set a default sort on a dynamic column in agGrid ...
I was just looking into onGridReady.... But it doesn't work. :-( I'll update my code to show you. – CNDyson. Nov 25, 2019...
Read more >
How do I change the default sort order on Windows Explorer ...
Select View tab, Apply to all folders. This will always sort folders for that document type by date since it is the first...
Read more >
Sort and SortByColumns functions in Power Apps
To sort first by one column and then by another, you embed a Sort ... SortByColumns can sort based on a single column...
Read more >
Configuring the default Results Table sort order and summary ...
To change the column used in the last sort rule, click the arrow next to the column name, then select the new column....
Read more >
How to change the sort order of items in visualizations in ...
Each data type has its own default sort order, but for strings you ... the value from the original column into a String,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found