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.

[QUESTION] How to set permanent sort on table?

See original GitHub issue

Hi. I’m using useTable with initialSorter without syncWithLocation. But when I change page, the initial sort is missing. I see that there are permanentFilter.

In my case, I have a table of products. Each products have index field as the order to display in store frontpage, and seller can reorder their index.

const { tableProps, tableQueryResult, searchFormProps, filters } = useTable<IProduct>({
  initialSorter: [{
    field: 'index',
    order: 'asc',
  }],
  metaData: {
    fields: ['name', 'description''],
  },
});

When I open the page, it display the first page correctly by sending sort to graphql query.

image

But when I change to next page, the sort field is empty.

image

Is there any way to set the table with permanent sorter?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
niwasmalacommented, Jan 13, 2022

Thanks a lot!

Currently I’m patching it by adding sort field to metadata and handle it on data provider.

0reactions
omeraplakcommented, Jan 13, 2022

Hey @niwasmala , We’ve released @pankod/refine@2.6.0 with permanentSorter support! Could you approve this fix?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to sort a MYSQL table in a permanent way?
You can do this with ALTER TABLE. f.e.. ALTER TABLE tablename ORDER BY columnname ASC;. but be aware that the table does not...
Read more >
Sort data in a range or table - Microsoft Support
Select the range that you just entered. Using the preceding example, select cells A1:A3. Go to File > Options > Advanced > General...
Read more >
Can you keep a sort on a column for a table?
It's a bit hacky, but you can sort the table how you want in view-mode, copy the rows, then edit the page and...
Read more >
Permanent Sort Criteria - Ask TOM - Oracle
Permanent Sort Criteria We can use 'ORDER BY' clause for sorting data when running a SELECT query.But what if I want a permanent...
Read more >
Can a default sort order be set on a table? - ServiceNow
Solved: I want to add a new module to the navigator and wanted to know if I can create a sorted view of...
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