Okay
  Public Ticket #2634657
Wait for User to Stop Typing and ajax call
Closed

Comments

  • Sina started the conversation

    Hi Team

    As you know, the search is done by Ajax
    As a result, by typing each word, a request is sent to the server, which does not seem very logical
    For example, if we want to search for an 11-digit number, 11 requests are sent to the server, and if each one lasts 5 seconds, our total search time will be 55 seconds.
    In large tables this problem has become extremely problematic
    This problem already exists for me and is not a guess
    I have a series of suggestions to fix it:
    In the settings of each table we can choose whether the search structure is Ajax or not
    In the settings you allow us to create a time delay, for example the request is sent to the server after n second
    Or the request is sent to the server after the user types
    Or, in the settings, it will be possible for us to place a search button so that the user can see the results after entering the desired values and pressing the search button.
    Or we can specify in the table settings according to the structure we have, then type n letters, numbers or … the request will be sent to the server.
    I hope that this proposal, which I think will have a great impact on performance, will be accepted.

    I tested this on your demo version
    And despite the server side being active, the requests were still sent in Ajax

    I also raised this issue in the WordPress topic
    But unfortunately I got the wrong answer completely regardless of the subject
    Thank you. If the subject is not clear to you, let me explain more fully


    Finally, do you temporarily suggest to me that I can do one of the above myself using jQuery?

    BR
    Sorry for weak english

  •  2,498
    Aleksandar replied

    Hello Sina

    Thanks for reaching out to us about this.

    You can freely attempt these changes yourself. I've forwarded the question to our development team, and I'll get back to you as soon as I hear back from them.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  2,498
    Aleksandar replied

    Hello again Sina

    Only server-side tables have ajax (manual tables and SQL query based tables). All other tables don't have ajax, and you can check this in the browser's inspect-console, in the network tab.

    The plugin is based on Datatables jQuery plugin, and this is their built-in option.

    Thank you for your suggestions:

    "In the settings of each table we can choose whether the search structure is Ajax or not"

    This can't be done because tables with over 2.000 rows are automatically switched to server-side tables, and ajax will be used.

    If you have a table with less than 2.000 rows, you can turn off server-side, and you'll have a global search without ajax. This is for SQL query based tables. If you have a manual table, you can go to its Editing tab above the table, and copy the table's MySQL table name for editing. Then, you can create an SQL query based table from that MySQL table name, and turn off server-side for that table as well (if it has less than 2.000 rows).

    "In the settings you allow us to create a time delay, for example the request is sent to the server after n second"

    This wasn't possible before, but in the new version of Datatables, there's a property searchDelay, which is still not perfect because it works after the second input.

    You can try using a hook.

     function extendJSONDescription($tableDescription, $tableId, $wpDataTable)
    { // $tableDescription is the PHP StdObj which contains all the necessary fields for initializing the table
    // $tableId is the table identifier from the MySQL table (wp_wpdatatables)
    // $wpDataTable in main object with all table and column properties
    // Check is it server side table if ($wpDataTable->serverSide()){
    //Default valuesfor searchDelay // Instant - for client-side processing // 400mS - for server-side processing // values is in milliseconds, we insert 5000, but you will set for your needs $tableDescription->dataTableParams->searchDelay = 5000;
    }
    return $tableDescription;
    }
    add_filter('wpdatatables_filter_table_description', 'extendJSONDescription', 10, 3);

    We will take this into consideration in the next period to see what can be done about this.

    Please tell me, why did you open the ticket in the pre-purchase section, and not in the wpDataTables section, since it's obvious you have the full version of the plugin?

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • Sina replied

    Hello gain Aleksandar
    First of all, thank you very much for your complete explanation

    To better understand this issue, I have prepared a video for you, which can be seen at the following link:

    https://www.mediafire.com/file/0m9ag3q7gdpki5q/Rec_0010.mp4/file

    As you can see in the video, a request is sent to the server by typing each word on my website
    But in your demo version, everything works properly, ie after the typing is completed, the request is sent to the server.
    The whole setting looks like your demo, however, where do you think the problem is?

  •  2,498
    Aleksandar replied

    Thank you for the screencast, Sina

    I forwarded it to our developer again, and I'll get back to you as soon as I have news.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  2,498
    Aleksandar replied

    Hello again Sina

    You don't seem to have the latest version of the plugin. We've included a 500ms delay when user is done with the entry, and that was included in the last update; that's why you can't replicate the issue on our sandbox site.

    Please update the plugin, and it should work fine after that.

    Since you didn't answer my question before, I have to ask you again - please tell me why did you open the ticket in the pre-purchase section, and not in the wpDataTables section, since it's obvious you have the full version of the plugin?

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • Sina replied

    Hello Dear Aleksandar 
    Yes, I use Version 3.0.4
    So I have to check this on the latest version

    Am I using this code correctly?
    Because there is no change in the search time delay!

    function extendJSONDescription($tableDescription, $tableId, $wpDataTable) {
    $tableDescription->dataTableParams->searchDelay = 50000000;
     return $tableDescription;
    }
    add_filter('wpdatatables_filter_table_description', 'extendJSONDescription', 10, 3);
    


    "Since you didn't answer my question before, I have to ask you again - please tell me why did you open the ticket in the pre-purchase section, and not in the wpDataTables section, since it's obvious you have the full version of the plugin?"

    This issue was on one of my friends' sites and I did not have access to their purchase code, so I open the ticket in the pre-purchase section.

    BR

  •  2,498
    Aleksandar replied

    Hi again Sina

    I don't know if that code will work for you, since we'd need to install that old version in order to test it. Older versions of the plugin are not supported, and should only be used for testing purposes.

    Early versions 3.X have some issues with WordPress 5.6, so you will need to update it to v3.3 as soon as possible to avoid any other issues with the plugin.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables