Using objects with data tables question

Using objects with data tables question

theg33ktheg33k Posts: 6Questions: 0Answers: 0
edited May 2011 in DataTables 1.8
This *might* be a bug but I'm leaning on me just not understanding how it works. I'm using an ajax source where the source is an array of JSON objects (new to 1.8) as recommended by you in a previous forum question. I tried all sorts of nonsense but I can't seem to get a vertical scrollbar to show up when using JSON for my source.

Here's my table definition
[code]
$('#merchantTableContainer').dataTable( {
'bPaginate': false,
'sScrollY': '150px',
'bFilter': false,
'sPaginationType': 'full_numbers',
'bInfo': false,
'bLengthChange': false,
'bSort': false,
'bAutoWidth': true,
'sAjaxSource': '/pos/rest/merchants/dataTable',
'bProcessing': true,
'bServerSide': true,
'aoColumns' : [{'mDataProp': 'id',
'bSearchable': false,
'bVisible': false},
{'mDataProp': 'displayName'},
{'mDataProp': 'clientId'}
]
} );
jQuery.fn.dataTableExt.oPagination.iFullNumbersShowPages = 0;
[/code]

Any suggestion on getting a scroll bar?

Thanks again for an awesome plugin.

Cheers!
G33k

Replies

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Possibly a daft question - but is your data taking up 150px or more in height? If not - then no scrollbar is needed and thus won't be displayed. Other than that - I don't see anything that might be wrong with your code. Can you share a link?

    Allan
  • theg33ktheg33k Posts: 6Questions: 0Answers: 0
    Not daft, you were right. There was a bug in my object creating the data table JSON object that caused it not to contain all of my objects. :( Sorry for the waste of time.
  • GregPGregP Posts: 487Questions: 8Answers: 0
    Somewhat related question: let's say I have a page with 4 DataTables. I currently do 4 requests. Are you saying that as of 1.8, I could do one request?
  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    No - each table still knows nothing about the other tables - so using the default configuration for DataTables that won't work. Having said that, it would be possible to do a single Ajax request and then feed that data to your four tables using aaData when they are initialised.

    Allan
This discussion has been closed.