Okay
  Public Ticket #3463273
Filter - Select Box Ordering
Closed

Comments

  • David started the conversation

    Hello,

    I created a table that connects to a MySQL View. Within this view, there is a field that specifies the ASME Class of our products. The values are: 150, 300, 600, 800, 900, 1500, 2500. This field is defined as an integer within the View (database) and within the wpdatatable.

    When the table is viewed, the column is sorted correctly (numerically). However, within the filter box (which is a select box) it appears to sort them alphanumerically. For example, 150, 1500, 2500, 300, 600, 800, 900. I suppose the select box is converting these values to strings?

    Is there a way to override this default behavior and cause the filter - select box to sort numerically?

    Thanks,

    David

  •  1,708
    Miloš replied

    Hi David,

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.


    The only way to change the order of the selectbox would be to manually add these values in the column settings, under the "Data" tab.

    So, access column settings and go to the Data tab. In there, change the type to String (if you haven't already), and change the "Possible values for column" to be "Define values list". Then, below that add the values in the order in which you want them to appear:

    4911970747.png

    And that's the order they will appear in the filter:

    3163312299.png

    I hope that helps.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • David replied

    Thank you!

    That will work. )

  •   Miloš replied privately