Skip to content

Recommended approach to reordering columns in a table #6203

Closed Answered by bri-fox
bri-fox asked this question in Q&A
Discussion options

You must be logged in to vote

for anyone who needs the answer:

The fix is to include dependencies={columns.items} on your TableBody.
Also columns={columns.items} on your Row.

export const Example = (args: any) => {
  console.log("render");
  let columns = useListData({
    initialItems: [
      { name: "Name", id: "name", isRowHeader: true },
      { name: "Type", id: "type" },
      { name: "Date Modified", id: "date" },
    ],
  });

  let rows = useListData({
    initialItems: [
      { id: 1, name: "Games", date: "6/7/2020", type: "File folder" },
      { id: 2, name: "Program Files", date: "4/7/2021", type: "File folder" },
      { id: 3, name: "bootmgr", date: "11/20/2010", type: "System file" },
      { id: 4, …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bri-fox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant