Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using a custom function to sort the table #43

Closed
pola88 opened this issue Sep 1, 2015 · 2 comments
Closed

Using a custom function to sort the table #43

pola88 opened this issue Sep 1, 2015 · 2 comments

Comments

@pola88
Copy link

pola88 commented Sep 1, 2015

Hi guys,

I want to start use this package, but I was wondering if I can set a function to handle the sorting, is it possible?

Thanks in advance,

@AllenFang
Copy link
Owner

HI @pola88, you cant set a customize function for sorting, but it's good idea for this component. I'll consider to add this feature in future.(recently)

@AllenFang
Copy link
Owner

HI @pola88, I've add this feature in newest version (v0.9.13), you can customize your sort function as follow

var data = [
    {name: "test1", count: 1},
    {name: "test2", count: 6}, 
    {name: "test5", count: 0}
];
function mySortFunc(a, b, order){   //order is desc or asc
    return a.count - b.count;
}
//...
<BootstrapTable data={data} >
      <TableHeaderColumn dataField="name" isKey={true}>Name</TableHeaderColumn>
      <TableHeaderColumn dataField="count" dataSort={true} sortFunc={mySortFunc}>Count</TableHeaderColumn>
</BootstrapTable>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants