Can you add a delay before filterBarMode: "immediate" begins searching?

Is it possible to add a delay time before the immediate type filterbar search begins? 

thanks

5 Replies

PE Punniyamoorthi Elangovan Syncfusion Team March 15, 2018 03:16 PM UTC

Hi Bryan, 
There is no support for adding a time delay in immediate type filterbar search mode and it is not a recommended approach as it will affect the keypress event. We suggest you to use the ‘onEnter’ filterbar search mode instead, where the filter operation will be initiated only on enter key press in the filter bar. 
Please find the below link to know more about filterbar modes in TreeGrid. 
Regards, 
Punniyamoorthi 



BC Bryan Conlon(no longer in company) March 15, 2018 03:25 PM UTC

Thank you Punniyamoorthi 


I have seen the onenter but i would like an instant search as i type but with a large dataset it hangs the cursor on the search box as i type and makes the search appear unresponsive for a second or 2.

is there any way to prevent this?


PE Punniyamoorthi Elangovan Syncfusion Team March 19, 2018 12:30 PM UTC

Hi Bryan, 
Thank you for your patience 
We have achieved your requirement by calling the filterColumn method within the create client side event. In the below workaround we have used the ‘onEnter’ filter bar search mode, but still you can filter the Treegrid content while entering the search query in the filter bar. As we faced issues while using the ‘immediate’ filter bar search mode, we have replaced it. Please refer the code snippet below 
<script type="text/javascript"> 
 $("#TreeGridContainer").ejTreeGrid({ 
             filterSettings: { 
               filterBarMode: "onEnter" 
              }, 
    create: function () { 
          $("#TreeGridContainer_taskName_filterbarcell").bind('keyup', function (e) { 
                timer = setTimeout(function () { 
                var text = $("#TreeGridContainer_taskName_filterbarcell").val(); 
                var treeObject = $("#TreeGridContainer").data("ejTreeGrid"); 
                treeObject.filterColumn("taskName", "startswith", text, "and"); 
                },2000); 
              }); 
           },  
         }) 
</script> 
 
We have prepared the JS Playground sample with your requirement please find below 
Regards, 
Punniyamoorthi 



PA paulwings June 8, 2022 06:54 AM UTC

jQuery delay() will not do the job. The problem with delay() is it's part of the animation system, and only applies to animation queues. As per jQuery Documentation: The .delay() method is best for delaying between queued jQuery effects. Because it is limited—it doesn't, for example, offer a way to cancel the delay—.delay() is not a replacement for JavaScript's native setTimeout function, which may be more appropriate for certain use cases to jQuery wait.


setTimeout(

function()

{

  //do something special

}, 5000);





PS Premkumar Sudalaimuthu Syncfusion Team June 14, 2022 02:44 AM UTC

Hi paulwings ,


As we did not suggest anything regarding delay() method. We cant understand your query properly. We request you to elaborate on your query which helps us to provide you a better solution.


Regards,

Premkumar S


Loader.
Up arrow icon