-
Notifications
You must be signed in to change notification settings - Fork 775
sortFunc does not work if using multiple times the same dataField #425
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
Comments
@jfremy, I seems to know your problem, but I want to be certainly to get this problem, so any examples to reproduce it?
If it's the only one solution, I think it's ok, but we need do it carefully and testing more. Anyway, you can open a PR, but I just want a example for me to check this :) Thanks you contribution. You did a great job! |
BTW, if |
Hi, The bug itself would still be present though. |
@jfremy, I thinks so too, but this PR need some improvements so that this issues may not be fixed quickly. |
Here's a simple example that triggers the issue Let's assume your data is: and the columns properties are: Then sortFunc will never be called because the last column (order matters) will essentially "overwrite" the settings that were defined for the second column. |
Hi,
I'm creating an issue first before working on some code to fix this to get your opinion.
The issue is the following:
I use the same dataField in multiple columns (I do so because the property targeted by dataField is an object and I display one part or another of the object depending on the column).
I also want to be able to sort those columns based on the displayed information.
So that requires to use a custom sortFunc.
However, since TableDataStore keys the colInfos structure based on the dataField value, in the end, there is only one set of sorting options available.
I cannot use the sortFuncExtraData object to workaround this since it's subject to the same issue.
The only option I see to fix this is keep the array structure provided in the input to Bootstrap table and update the sort / filter part of the code to use the index of the column rather than the dataField + update calls to this code.
What do you think?
Is that an approach you would accept in a pull request?
The text was updated successfully, but these errors were encountered: