case sensitive preselect in searchpanes

case sensitive preselect in searchpanes

Khalid TeliKhalid Teli Posts: 251Questions: 71Answers: 0

HI @sandy
I was trying to use thesearchPanes preselect options to select some values from search panes. However it appears to be case sensitive , for example if I use : preSelect: ['edinburgh','London'] , it will only select rows with location as London.
How can I select the both locations ?

live.datatables.net/labasobo/1/

Thank you
Kind Regards,
K Teli

This question has an accepted answers - jump to answer

Answers

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @Khalid Teli ,

    Sorry I might be being daft here but why can you not just capitalise the "e" to select the correct option? See here.

    Thanks,
    Sandy

  • Khalid TeliKhalid Teli Posts: 251Questions: 71Answers: 0

    Hi @sandy
    Yes, I can.
    In my actual use case , I use a external variable in preSelect where I get the information from cookie , for example var abc= ['Choclate milk', 'Cookies','Butter cream' ].

    In my database these are saved as['Choclate Milk', 'Cookies','Butter Cream' ] (first character of each word is Uppercase). So in order to correctly select these values from DB , I will have to use javascript function to make the first character of each word Uppercase in var abc .

    Which is not an issue , I was just wondering if there is a way to not make these preSelect values case sensitive so I won't have to write a function to change the first characters of each word to Uppercase.

              columnDefs: [
                  {
                    searchPanes: {
                      preSelect: abc
                    },
                    targets: [2]
                  }
                ]
    

    Thank you
    Kind Regards,
    KT

  • colincolin Posts: 15,142Questions: 1Answers: 2,586
    Answer ✓

    For most use cases, those two strings would want to be treated differently, as they are effectively different strings. The simplest way for you would be to either store the cookie with the correct casing, or change it upon retrieval.

    Colin

  • Khalid TeliKhalid Teli Posts: 251Questions: 71Answers: 0

    @collin Thank you

Sign In or Register to comment.