SearchPanes & server-side processing; waiting before firing the query?

SearchPanes & server-side processing; waiting before firing the query?

tefdattefdat Posts: 42Questions: 7Answers: 3
edited December 2020 in Free community support

Hi,
I have several searchpane filters/categories, where usually multi-select is been used respectively several selections been made by users for getting the desired result.

Currently on each click a search is been fired, which can take a fews seconds on big database and which bothers the users.

Question; is there an option or can a "hack" been suggested so that the firing of the search can be delayed?
Time could just start counting after the last selection/change in searchpanes..

I searched through the Docs, APis and the forum - but did not find anything similar.
Regards...

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    searchDelay was intended for this, but I suspect you're right and that SearchPanes doesn't consider this.

    I've raised it internally (DD-1766 for my reference) and we'll report back here when there's an update.

    Cheers,

    Colin

  • tefdattefdat Posts: 42Questions: 7Answers: 3
    edited December 2020

    Thank you colin.
    I know the search delay. I optimized this even, so that the time counts after the last key press.

    It might the wrong thread - anyway, let me share my 'debouncing' approach :)
    I am using [selectize ](https://selectize.github.io/selectize.js/ "selectize " as search bar replacement, thatswhy its a litte bit different - but showing the "debouncing" it should not make a difference):

        var stime, last_search, warnTime;
        function execute_search(val,immediate,timeFactor=1){
            if (immediate) {
                dtable.search(val).draw();
            } 
            else {
                stime = setInterval(function(){
                    dtable.search(val).draw();
                    clearInterval(stime);
                }, (2000 * timeFactor));
            }
        }
            //usual search will be fired after execution of time and last
            //key press (and if the search, differs from the last search)
            //autosearch is a feature and can be disabled
            if (fValArrNew.length >= 1 && fVal !== lastSearch) {
                clearInterval(stime);
                lastSearch = fVal;
                cnf_autosearch ? execute_search(fVal,false,1) : null;
            }
    
            //evaluate clear all button - if button is pushed, a query will be fired much later
            var obj = $('a.clearAllSuggestions').click(function() { 
                that.clear();
                fValCRM = "";
                clearInterval(stime);
                execute_search(fVal,false,2);
            });
    
            //evaluate ENTER - immediately fire the search
            this.on('submit', function () {
                lastSearch = fVal;
                clearInterval(stime);
                execute_search(fVal,true);
            }, this);
    
  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Nice, thanks for posting,

    Colin

  • tefdattefdat Posts: 42Questions: 7Answers: 3
    edited February 2021

    @colin ,
    may I ask if you have any news on this?

    Roughly summarized; an adjustable time would be great for firing the search, if entries from the searchPanes columns are selected.

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    It's still in the backlog, I'm afraid. It's unlikely to be address in the near future as we're focusing effort in other areas right now,

    Colin

  • tefdattefdat Posts: 42Questions: 7Answers: 3
    edited June 2021

    Hi,
    meanwhile i figured out the change. Its a minor change and somehow was prepared, at least for the deselection part.

    Red Square = necessary changes. Screenshots is from SearchPanes v1.2.2

    Getting this delay adjustable with an parameter would be great of course.

    Regards..

Sign In or Register to comment.