Allan please help with tabs
Allan please help with tabs
hi allan
i'm stuck,
i'm using datatables for my company and i'm stuck at the moment,
i have a table that have a bunch of data, in my application, i loop through all the data in display it in my datatable, but the problem is my boss want tabs
and i dont know how to display the data in each tab based on the data
i have something like that (tabs)
| 191 | 194 | 197 | 198 | 199 |
what i've done so far is something like that :
[code]
$(document).ready(function() {
$('#tabs').tabs({
"show": function(event, ui){
var table = $.fn.dataTable.fnTables(true);
if (table.length > 0) {$(table).datatables().fnAdjustColumnSizing();}
$(table).fnReloadAjax("{{URL::to('api/do/test')}}" + activeIndex);
}
});
var activeIndex = $("#tabs").tabs('option', 'active') + 1;
var oTable = $('#tblFolio_' + centre).dataTable( {
"aaSorting": [[ 0, "desc" ]],
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_ Enregistrements par page"
},
"aoColumns": [
{ "bSearchable": false,"bVisible": false },
{ "bSearchable": false,"bVisible": false },
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "{{ URL::to('api/do/test')}}/" + activeIndex,
"fnFooterCallback": function( nRow, aData, iStart, iEnd, aiDisplay ) {
var columns = [4,5];
for (var i in columns){
var columnActuelle = columns[i];
var total = 0;
for (var j = iStart; j < iEnd; j++) {
total = total + parseFloat(aData[aiDisplay[j]][columnActuelle]);
}
$($(nRow).children().get(columnActuelle - 1)).html(total);
}
}
});
});
[/code]
the : "sAjaxSource": "{{ URL::to('api/do/test')}}/" + activeIndex, fetch me the data based on the url like:
localhost/myApp.com/api/do/test/1
localhost/myApp.com/api/do/test/2
localhost/myApp.com/api/do/test/3
localhost/myApp.com/api/do/test/4
localhost/myApp.com/api/do/test/5
when i visit those URL i do get a well formatted json for Datatables, and it works, i get the data in my table, but i dont know how to separate those into tabs
do i have to make a json for EACH data ?
here is my json for this URL : localhost/myApp.com/api/do/test/5
http://pastebin.com/2prAYQh6
as you can see i need the separate the data based on centre_id
how can i do that, please?
i'm really stuck and i've looked everywhere without luck, i've found a thread about tabs here but it did not help'd me. nor stackoverflow
thx alot all, thx allan
i'm stuck,
i'm using datatables for my company and i'm stuck at the moment,
i have a table that have a bunch of data, in my application, i loop through all the data in display it in my datatable, but the problem is my boss want tabs
and i dont know how to display the data in each tab based on the data
i have something like that (tabs)
| 191 | 194 | 197 | 198 | 199 |
what i've done so far is something like that :
[code]
$(document).ready(function() {
$('#tabs').tabs({
"show": function(event, ui){
var table = $.fn.dataTable.fnTables(true);
if (table.length > 0) {$(table).datatables().fnAdjustColumnSizing();}
$(table).fnReloadAjax("{{URL::to('api/do/test')}}" + activeIndex);
}
});
var activeIndex = $("#tabs").tabs('option', 'active') + 1;
var oTable = $('#tblFolio_' + centre).dataTable( {
"aaSorting": [[ 0, "desc" ]],
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_ Enregistrements par page"
},
"aoColumns": [
{ "bSearchable": false,"bVisible": false },
{ "bSearchable": false,"bVisible": false },
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "{{ URL::to('api/do/test')}}/" + activeIndex,
"fnFooterCallback": function( nRow, aData, iStart, iEnd, aiDisplay ) {
var columns = [4,5];
for (var i in columns){
var columnActuelle = columns[i];
var total = 0;
for (var j = iStart; j < iEnd; j++) {
total = total + parseFloat(aData[aiDisplay[j]][columnActuelle]);
}
$($(nRow).children().get(columnActuelle - 1)).html(total);
}
}
});
});
[/code]
the : "sAjaxSource": "{{ URL::to('api/do/test')}}/" + activeIndex, fetch me the data based on the url like:
localhost/myApp.com/api/do/test/1
localhost/myApp.com/api/do/test/2
localhost/myApp.com/api/do/test/3
localhost/myApp.com/api/do/test/4
localhost/myApp.com/api/do/test/5
when i visit those URL i do get a well formatted json for Datatables, and it works, i get the data in my table, but i dont know how to separate those into tabs
do i have to make a json for EACH data ?
here is my json for this URL : localhost/myApp.com/api/do/test/5
http://pastebin.com/2prAYQh6
as you can see i need the separate the data based on centre_id
how can i do that, please?
i'm really stuck and i've looked everywhere without luck, i've found a thread about tabs here but it did not help'd me. nor stackoverflow
thx alot all, thx allan
This discussion has been closed.