Why i'm getting more than request and responses

Why i'm getting more than request and responses

tameem07tameem07 Posts: 7Questions: 2Answers: 0


when i'm searching a single alphabet i'm getting 6 request and 6 responses

Answers

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    when i'm searching a single alphabet i'm getting 6 request and 6 responses

    Please provide more details of what you are doing, what you expect and your Datatables initialization code.

    My guess is you have server side processing enabled (serverSide: true) and that you have type 6 characters into the search input. This is expected behavior as by default each character will perform a search.

    Kevin

  • tameem07tameem07 Posts: 7Questions: 2Answers: 0

    yes thats true that ive enabled server side and yes i've 6 columns too ..how can it be fixed?

  • tameem07tameem07 Posts: 7Questions: 2Answers: 0

    and if i try (serverSide: false) an error flashes something like this: NoMethodError (undefined method `[]' for nil:NilClass):

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    yes i've 6 columns too

    That won't affect the requests sent. In your screenshot above did you type 6 characters?

    if i try (serverSide: false) an error flashes something like this: NoMethodError (undefined method `[]' for nil:NilClass):

    Don't know what that would be. We will need to have a link to you page or a test case to debug that error.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • tameem07tameem07 Posts: 7Questions: 2Answers: 0

    I'm sorry i cant provide a link of my page.
    Here is the code that i used to search by pressing enter.

    I'm trying to find out what causes so many requests when I simply press enter on a single column

    This is how my header looks like

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    I don't see anything that stands out as an issue with the code. Please use one of the server side processing templates here to replicate the issue:
    https://datatables.net/manual/tech-notes/9#Server-side-processing

    Is your code snippet executed inside a loop?

    Kevin

  • tameem07tameem07 Posts: 7Questions: 2Answers: 0

    My code is not inside a loop.. Well ive tried something which works well and gives 1 request and response as expected .. But now the problem is it works in footer can you please guide me so that it can work in header

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    Here is an example:
    http://live.datatables.net/giharaka/1/edit

    Note the us of orderCellsTop to move the sorting event listeners to the top header row.

    Kevin

  • tameem07tameem07 Posts: 7Questions: 2Answers: 0

    Thanks kevin the problem is resolved..

This discussion has been closed.