Can I make multiple predefined search queries from a select field?

Can I make multiple predefined search queries from a select field?

arie0512arie0512 Posts: 26Questions: 7Answers: 0

Hello,

I want to make for my collegues some predefined search queries.

What I want is a select field with predefined seatch queries. For example sometime like this:

<select name="predined_search" id="predined_search">
  <option value="name_starts_with_a">Name starts with an A</option>
  <option value="city_from_new_jyork">Clients from New York</option>
  <option value="age_greater_than_40">Older than 40</option>
</select>

Is this possible with SearchBuilder?

Best regards,

Arie

Answers

  • allanallan Posts: 65,588Questions: 1Answers: 10,904 Site admin

    To set a predefined filter when using SearchBuilder, use the searchBuilder.preDefined option.

    Allan

  • arie0512arie0512 Posts: 26Questions: 7Answers: 0

    I know this predifined option but that's only working for one search query.

    I want to have several search queries to the same datatable so the user can choose which predefined query he would like to see.

    Is that possible?

  • allanallan Posts: 65,588Questions: 1Answers: 10,904 Site admin

    I'm afraid I don't fully understand the question - sorry.

    Do you mean you want to have multiple conditions applied to the table when it starts? If so, then criteria is an array - you can provide multiple conditions, as shown in the second example in the documentation for searchBuilder.preDefined.

    Or, do you mean you have somehow stored different predefined conditions, and you want the end user to select which one they want to load the table with? In which case, it would be up to you to provide the UI to let the end user select the condition and you would then assign that to searchBuilder.preDefined.

    Or, do you have a list of criteria and you want the end user to be able to pick one of them after the table has been created and have that applied? If so, you could use Buttons along with searchBuilder.rebuild() to set the SearchBuilder state.

    Allan

Sign In or Register to comment.