Datatable tabs with server side processing

Datatable tabs with server side processing

pawelpawel Posts: 14Questions: 0Answers: 0
edited October 2010 in General
Hi,

I'm working with server side processing and I'm trying to use tabs to allow the user to select different kinds of information. When I tried this example http://www.datatables.net/examples/api/tabs_and_scrolling.html the tabs worked but not as I wanted. First of all, can I do that? or am I crazy for trying ? hahaha.

I have two important problems:

1) As I tried, the code does all the server calls at the same time so if I have 4 tabs, it will do 4 calls and that isn't useful

2) I lost all the functionallity of every table, for example, I'm not able to use the pagination.

Hope I had describe fine my situation, any idea will be useful !.

Cheers,
Pawel.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    With problem 1, you probably want to do that DataTables initialisation when each tab is first shown. The tabs control will provide some kind of hook / event for that.

    2. Sounds like a Javascript error to me? However, I'd look at getting point 1 sorted if it's not first.

    Allan
  • pawelpawel Posts: 14Questions: 0Answers: 0
    Hi Allan,

    Thanks for replying. About the first problem, I'm working on that and trying to find the event for what I want but I think it isn't too much difficult to change, thanks !. About the second problem, yesterday I resolved the problem with the pagination but I really don´t know how to use the oTable element to set the other functionallity, I mean, before I started to work with the tabs I use the oTable object, for example, like this:

    [code]
    $('#example tbody td:nth-child(5)').each(function() {
    var nTr = this.parentNode;
    var aData = oTable.fnGetData(nTr);
    var sTitle = aData[8];
    this.setAttribute('title', sTitle);
    });
    [/code]

    Now, with the change, is oTable a different kind of object? How can I access it? I was trying something like this to apply the new functionallity to all the tabs:

    [code]
    $('table.display tbody tr').each(function() {
    var nTr = this.parentNode;
    var aData = oTable.fnGetData(nTr);
    var sTitle = aData[8];
    this.setAttribute('title', sTitle);
    }
    [/code]

    The selector works fine and oTable has information but I guess that now is an Array, isn't it?

    Cheers,
    Pawel.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    If you initialise more than one table at a time, into oTable, then yes it is an array. You can use $.fn.dataTableExt.iApiIndex to change which table the API function you are using will operate on.

    Allan
  • pawelpawel Posts: 14Questions: 0Answers: 0
    Hi Allan,

    Thanks for replying. I will try it after resolve some lovely IE problems haha.

    Cheers,
    Pawel.
This discussion has been closed.