Few questions about searching using server side processing

Few questions about searching using server side processing

partyboypartyboy Posts: 18Questions: 0Answers: 0
edited February 2013 in General
Hi,

I'm using datatable with server side processing. It's working great and I'm polishing the configuration.

I have few questions left,

the search input :
- is it possible to configure his behaviour ? For example, is it possible to start requesting the server starting with 2 or 3 letters ?

- Is it possible to move the 'processing' div ? For example a loading gif in the center of the table ? As in my CSS, the processing appears at the same place as the input search.

And a last question; After datatable process my data's, I have to make some javascripts. It is working great almost all the time, I just put my javascript after the fnCallback function, as I'm overriding the fnServerData.

My problem is when I use the select input to choose the number of displayed elements. Let's say the default value is 10.
In my configuration, I load 50 elements and I'm using cache.

So datatable is displaying 10 elements and have 50 in cache. If I put the select to 25 elements, datatable is using my cached elements and regenerate the table, but my javascript is lost. Because datatable didn't call the server.
I'm not sure to be clear, but is it possible to call javascript after the 'select' entries has been changed ?

thanks !

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    > - is it possible to configure his behaviour ? For example, is it possible to start requesting the server starting with 2 or 3 letters ?

    Yes, but you need to detach the default event handler and then add your own which will call fnFilter . You might be interested in this plug-in which adds a bit of key debounce: http://datatables.net/plug-ins/api#fnSetFilteringDelay

    > - Is it possible to move the 'processing' div ? For example a loading gif in the center of the table ?

    Yes - in CSS. Use the `div.dataTables_processing` element style.

    > cache

    What cache? As in the pipelining example? It sounds like you might need to clear the cache or simply disable it.

    Allan
  • partyboypartyboy Posts: 18Questions: 0Answers: 0
    Thanks Allan !

    Yes for the cache, I'm using the pipelining example. I put my javascript at the end of it.
  • partyboypartyboy Posts: 18Questions: 0Answers: 0
    I'm checking the element style : dataTables_processing

    Do you preconize using sDom or creating a CSS class to display it ?

    I'm looking on how works the sDom property.

    How can I tell the dataTables_processing to be displayed in an other div for example ?

    Thanks !
  • partyboypartyboy Posts: 18Questions: 0Answers: 0
    I find a solution for the 'processing'. I create a CSS class. thanks.
  • partyboypartyboy Posts: 18Questions: 0Answers: 0
    Hi Allan,

    I'm almost done with my configuration, I'm still fighting with the javascript I have to execute after a redraw.

    So, I use the pipelining configuration, at the end I have to make a few javascript, as in my table I have a column that link elements to a popup or some processing.

    As I was telling yesterday, my problem come when I use the select that displays more or less elements.

    If elements are already cached, it doesn't call the server, so my javascript is never executed.

    I try to disable cache (but I still want to use it). But the problem appears too.

    For example, I display 50 elements from server, if I set the select to 25 or 10 elements, datables knows that datas are already there, so no call to the server, and no javascript.

    Is there a way to override the fnRedraw ? just call redraw as normal and my javascript after ?

    thanks
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Can you not just attach 'live' events to the table - assuming you are using events. What is the script you need to run? Another option is to use fnDrawCallback .

    Allan
  • partyboypartyboy Posts: 18Questions: 0Answers: 0
    Thanks fnDrawCallback is perfect !

    Sorry for not seeing that before ...
This discussion has been closed.