DataTable altered sorting behavior

UI Components for Vue
Post Reply
Searerva
Posts: 6
Joined: 15 Sep 2022, 11:55

16 Sep 2022, 09:44

Is it possible to change how DataTable sorts the data? I would like populated fields to be prioritized, so that in the list below, any date field is populated first, then blanks. Right now, blanks are treated as a higher order in the sorting. I think this might be locale-related, but can that be set per-table, or is there any way to implement custom sorting on DataTable?

Data Set

Code: Select all

Case Number    Followup Date
     123123       
     111111       2022-10-29
     222222    
     333333       2023-01-02
     444444       2023-01-03
     555555    
     666666       2022-09-25
Current behavior when sorting on Followup Date

Code: Select all

Case Number    Followup Date
     123123       
     222222    
     555555    
     666666       2022-09-25
     111111       2022-10-29
     333333       2023-01-02
     444444       2023-01-03
Wanted behavior when sorting on Followup Date

Code: Select all

Case Number    Followup Date
     666666       2022-09-25
     111111       2022-10-29
     333333       2023-01-02
     444444       2023-01-03
     123123       
     222222    
     555555    

Searerva
Posts: 6
Joined: 15 Sep 2022, 11:55

13 Oct 2022, 15:43

I solved this one by setting blanks to 2100-01-01, and sorting, then hiding the value when rendering. Not pretty, but working.

Post Reply

Return to “PrimeVue”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests