advice on how to create a filter/search on editor dropdown list

advice on how to create a filter/search on editor dropdown list

cpshartcpshart Posts: 246Questions: 49Answers: 5

Hi

Can someone advise me the best way to provide a filter/search for a datatables.net Editor modal dropdown. Are there any examples in the JS Bin.

In my example I have an extensive list of stocks (around 3500) which I need to allow the user to filter the dropdown to a more manageable size to avoid lots of scrolling etc.

Ideally I would like to be able to search on 2 columns stock symbol and name, so the search would filter matches on either column for each keystroke.

e.g.

Search Box
G filters all symbols and names matching G*
GS filters all symbols and names matching GS* etc.

Many thanks

Colin

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,160Questions: 26Answers: 4,921
    Answer ✓
  • cpshartcpshart Posts: 246Questions: 49Answers: 5

    Hi Kevin

    Thanks for the links, that may give me a start, as I need to apply the 1st multi_filter to the select in an editor modal.

    I will see how I can integrate the code and get back to you.

    Many Thanks

    Colin

  • cpshartcpshart Posts: 246Questions: 49Answers: 5

    Hi Kevin

    So, I can filter the editor dropdown list using Options as follows :-->

                    ->where( function ( $q ) use ( $search) {
                                 $q->where('dm_stocks.symbol', $search, 'LIKE' );
                                })
    
    

    then pass the variable $search from the client which applies the filter to the dropdown list.

    How do I create some html filter input box on the editor modal above or as part of the dropdown list ?

    Thanks

    Colin

  • cpshartcpshart Posts: 246Questions: 49Answers: 5

    Hi Kevin

    I am investigating the use of select2 to create my search box

    Colin

This discussion has been closed.