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.

DataTable sortRow function needs additional information

See original GitHub issue

Summary

For <DataTable sortRow="{customSortRow}" ...>, customSortRow function needs additional values (rowA and rowB) to properly sort complex cells.

For a DataTable that contains complex cells, such as a <Link onClick={doClick(row.url)}>{row.name}</Link> , or <>{formatDate(row.date)}</>, the default sort does not handle complex cells correctly. Using sortRow={customSortRow} does not help, because for complex cells, the objects passed to customSortRow(cellA, cellB, …) are React components.

Justification

Our customers will demand the ability to correctly sort even on complex cells.

Desired UX and success metrics

customSortRow will be passed the necessary information (rowA and rowB) to properly sort complex cells.

“Must have” functionality

In addition to the parameters already passed to the customSortRow(cellA, cellB, {key, sortDirection, locale, sortStates, compare}, please add rowA and rowB to the third parameter object.

Specific timeline issues / requests

It is related to a December 2019 deliverable.

Available extra resources

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
asudohcommented, Sep 27, 2019

Hi 👋 thank you for reporting! A workaround is writing state manager for table by your own, our data table has low-level presentational components, like <TableRow>.

0reactions
emyarodcommented, Jun 8, 2021

as mentioned earlier most likely you would need to implement this with a custom state manager, meaning you would be implementing that logic using Carbon table primitives like Table, TableHead, TableRow, etc. rather than using the built in state manager in DataTable, if that makes sense

Read more comments on GitHub >

github_iconTop Results From Across the Web

On sorting the rows by columns the function gets overridden ...
On sorting the rows by columns the function gets overridden with the default function — DataTables forums.
Read more >
sort row groupings in datatables - Stack Overflow
I am using datables and jquery row grouping.. ... $(document).ready(function () { $('#main').dataTable({ "bLengthChange": false, "bPaginate": ...
Read more >
Arrange rows by column values - dplyr
arrange() orders the rows of a data frame by the values of selected columns. Unlike other dplyr verbs, arrange() largely ignores grouping; you...
Read more >
Pandas Sort: Your Guide to Sorting Data in Python - Real Python
You'll learn how to sort by one or more columns and by index in ascending or ... like working with data types, dictionaries,...
Read more >
Row Sorting - Angular Data Grid
This page describes how to sort row data in the grid and how you can customise that sorting ... You don't need to...
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