Append to my table, new data from server-side

Append to my table, new data from server-side

oaloal Posts: 6Questions: 0Answers: 0
edited February 2013 in DataTables 1.9
Hi !

Thanks for this plugin, it's totally Awesome !
My server is very slow ... And i can't change it.. So when i load the datatable, i must develop an functionalities for append more data to the table after clicking on a button..

i want something like this :

[code]
$('#display-more').click(function (e) {
// call Ajax and success(data)
oTable.fnAddData(data.aaData);
oSettings._iDisplayLength = 200; //Example
});
[/code]

The table already work server-side for clicking "next", "previous" etc...
But When i click to "Display-more" button.. That doesn't work..(If i add oTable.fnAddData(data.aaData); in fnInitComplete, data are added..)
And oTable.fnAddData() call fnServerData and i don't want to call it...

the principale function must append data to the table without clear the table or re-add data already add with the init when i load my page

have you an idea ?

Thanks

Replies

  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin
    > And oTable.fnAddData() call fnServerData and i don't want to call it...

    If you have server-side processing enabled it will yes. That's the while point of server-side processing. Do you have sever-side processing enabled? I can't tell from the above - please post a test case: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read

    Allan
  • oaloal Posts: 6Questions: 0Answers: 0
    Hi,

    This example doesn't work... but it should be..

    http://live.datatables.net/odetow/2/edit

    In fact : my functionalities is the same when you click in dropbox for change the display-length but when you are server-side if during the load you display 100 rows and you change it for display 120 rows, you ask 120 rows instead of next 20 rows...

    How can i do this ?
  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin
    edited February 2013
    I dont' really understand what you are trying got do with that code? Move the display by a few rows? It isn't adding any more data certainly. You need to use fnAddData for that.
  • oaloal Posts: 6Questions: 0Answers: 0
    I don't want call my server-side for receive 20 rows (examples) when there is already 10 rows...
    i would like to keep my 10 rows and add 10 another rows (so 10 next rows) with server-side and display this 20 rows.

    another example :

    i load 1000 rows and the user can choose to display 1010 rows. I would like to call my server-side for receive this 10 additional rows. By default, datatable ask 1010 rows

    Can i change this ?
  • oaloal Posts: 6Questions: 0Answers: 0
    The fnAddData documentation specifically says:

    [quote]if you are using server-side processing (i.e. "bServerSide": true), then to add data, you must add it to the data source, i.e. the server-side, through an Ajax call.[/quote]

    Do you have an example ?
  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin
    I still don't know if you are using server-side processing. Are you?

    If you are, then every page requires an Ajax get, that's how server-side processing works. You could use caching like in this example: http://datatables.net/release-datatables/examples/server_side/pipeline.html

    Allan
  • oaloal Posts: 6Questions: 0Answers: 0
    i check this ! Thank you very much for your help !
This discussion has been closed.