primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Datatable: initial binding to sortField does not pay attention to custom sorting

Open ntkolev opened this issue 9 years ago • 3 comments

I'm submitting a ... (check one with "x")

[x ] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports) http://plnkr.co/edit/uZpUXkedoAYhkelZvaye?p=info

Current behavior I have a [sortField] binding on a column with custom sorting. When the datatable is initially created, it pays attention to which column it should apply sorting (an it does), but it does not pay attention if that column has custom sorting applied.

Expected behavior The datatable should invoke the custom sorting function when binding a [sortField].

Minimal reproduction of the problem with instructions Check the plunkr out. When you run it you will notice the ID field sorted. It does not invoke the custom sorting function at all. When you start clicking on the columns, you will see the custom function being called.

Please tell us about your environment:

  • Angular version: ^4.4.3

  • PrimeNG version: ^4.2.1

  • Browser: all

ntkolev avatar Nov 16 '17 11:11 ntkolev

  • 1

sante85 avatar Nov 16 '17 11:11 sante85

Unable to replicate, please provide a test case based on plunkr below and we'll review again.

http://plnkr.co/edit/6q5v84DWolH6DeAdi70w?p=info

cagataycivici avatar Nov 17 '17 11:11 cagataycivici

There you go. http://plnkr.co/edit/kFoko7sIbfdPzhEFGkSe?p=preview I don't see the difference between the original plunkr I provided. As you can see the ID field is sorted but it is not sorted using the custom function. It has an alert() in it.

ntkolev avatar Nov 17 '17 12:11 ntkolev