React-bootstrap-table2: Sort by different value than formatter returns

Created on 3 Sep 2019  路  4Comments  路  Source: react-bootstrap-table/react-bootstrap-table2

Hello,

Is it somehow possible to change the sorted value of a column ? I use a column formatter which returns html but need to sort for a specific value inside of that. Something similar to filterValue option (sortValue) would be awesome.
```
{
dataField: 'versionList',
text: 'Versionen',
formatter: (cellContent, row) => {
return

sortedText ....

..

;
},
sort: true
}

help wanted sort

All 4 comments

@fabianbloching I will implement it soon, thanks!

RELEASE NOTE

This issue was fixed, please upgrade all the packages listed in above

Now, you can use sortValue
https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/column-props.html#columnsortvalue-function

:heart: thank you

formatter is meant to change the HTML output that goes into the actual <table>.

It seems un-intuitive to me that it also mangles the actual internal data that is being passed around in the library.

As a user, I would expect that formatter doesnt mangle my data. Why should I have to add another sortValue? This solution seems unintuitive, and it does not scale. If I have to add sortValue to any sortable column that has custom formatting, that that means I have to do it for _almost everything_, as formatter is quite frequently used.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

primakashi picture primakashi  路  3Comments

Randore picture Randore  路  3Comments

eylonronen picture eylonronen  路  3Comments

prajapati-parth picture prajapati-parth  路  4Comments

rsgoss picture rsgoss  路  4Comments