Newbie ,Please Help integrate with server side

Newbie ,Please Help integrate with server side

blacksenseiblacksensei Posts: 2Questions: 0Answers: 0
edited February 2012 in General
Hello Good People!

I've just discovered this awesome plugin, i've looked at jqGrid and SlickGrid and decided to give a try to Datatables.
I am not sure about where to start the integration from or which param to use. My guess is that the way i would want to use Datables has
already being provided.Here is the scenario: let's say i have object student with child association (one-to-many) courses.
i have a way to display each student information on the page and would like to display now a list of courses applied for the student in a table.
Supposing there are 1000 courses average for each student i would like to display just 20 on page load and then do an ajax call to fetch the next chunk with pagination.

FIrst question : is my scenario possible?
Second question: is possible to create a table with the first twenty and expect datatable to enhance it and go get the page 2 via ajax with the appropriate url?
Third question: how to pass the student id to the ajax url (like "sAjaxSource": "/student/{id}/course/list") since only server knows the id.
Fourth question: what parameters should i be looking at? "iDeferLoading" ? "bDeferRender" ?

thanks for reading and helping out. great plugin

Replies

  • blacksenseiblacksensei Posts: 2Questions: 0Answers: 0
    AnyOne?
  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin
    > FIrst question : is my scenario possible?

    I'm not 100% sure how it is that you want to present the display, but DataTables currently doesn't have support for child rows if you wanted to show it that way. However, one option would be to use fnOpen to show a details row with the selected courses. Or a separate table or even a separate page with the courses for the selected student.

    > Second question: is possible to create a table with the first twenty and expect datatable to enhance it and go get the page 2 via ajax with the appropriate url?

    Like this: http://datatables.net/release-datatables/examples/server_side/defer_loading.html ?

    > Third question: how to pass the student id to the ajax url (like "sAjaxSource": "/student/{id}/course/list") since only server knows the id.

    If only the server knows the id - then how would the client-side be able to populate the URL? It sounds like you would need to pass the ID to the client-side, either as a row ID, a hidden column or an non-display object property.

    > Fourth question: what parameters should i be looking at? "iDeferLoading" ? "bDeferRender" ?

    From what you are saying it sounds like you are looking at server-side processing - for which you should read this page: http://datatables.net/usage/server-side . However, I'd be surprised is server-side processing is needed - I think Ajax loading for client-side processing will be fine for just 1000 rows - http://datatables.net/release-datatables/examples/data_sources/ajax.html

    Allan
This discussion has been closed.