pagination by reloading data from backend

pagination by reloading data from backend

nsm26nsm26 Posts: 2Questions: 0Answers: 0
edited October 2011 in General
First of all well done and thanks for an excellent piece fo work.
Secondly I am new to jQuery and Ajax so need some help in terms of the way I am using your plugin.

I have implemented the dataTables plugin successfully so that all the desired features are available on the table that gets populated upon loading a page. Basically a url such as "/accounts/list" lists all the accounts in a table and using your excellent plugin I get all the benefits of sorting, filtering (based on individual columns), pagination etc. However, the current implementation paginates on the entire table data where when the page is loaded, the entire data is pulled up. What I want is to load the page with subset of data (say 100 accounts) so that the current filters operate on the fetched 100 records. Further more, what I want is that any subsequent retrieve, i.e. when user clicks on next page or changes the filter criteria, new records (based on the filter) are fetched from the backend. Or in other words, the current page should only contain the accounts based on the filter or page and not everything (as is the case now).

I can see in some of the examples that it can be achieved using Ajax or server side processing, however both the techniques employ some kind of server scripts. Do I really have to use a script to get the desired results or can I not pass in the url with the query parameters to get what I want.
I mean, what I was expecting to be able to do is to pass a url such as "/accounts/list" as the source of the data along with filter critera such as, "accountTypes=savings" etc.. and get the table populated from that result. So everytime the filter is changed or user clicks the next page, the new set of data is retrieved from the backed using the same url but with different parameters.

Not sure if I am making much sense here, but I would appreciate if you can guide me here.

Thanks a lot...

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    If you continually add to the filters, the existing filters are still in effect.

    So if you click one of your links and it simply adds more filtering to narrow down the field, it will compound the filtering in place.

    The solution would be to keep the existing filters and apply them as well as any new filtering.

    If I haven't made this clear, feel free to ask follow up questions.
  • nsm26nsm26 Posts: 2Questions: 0Answers: 0
    Thanks fbas, as I anticipated, I did not put the question correctly.
    The problem I have is that I want to use server side processing so that everytime I select a value from the filter or go to the next page or sort etc., it gets data from backend. At the moment the entire contents fo my database are loaded onto the page and changing the filter or going to the next page is happening at the front end side.
    All I want is to use get data from the backend using Ajax/server side processing and more importantly without using php script. As I am new to Ajax, I was wondering can I not specify my url (which gets the data in the first place) as the ajax source so that for any relevant event on the page, that url is called up with the suitable parameters (such as filter criteria or paging details) and corresponding data is returned to display/update the table.
    Please excuse my ignorance on this subject.

    Thanks a lot.
This discussion has been closed.