using tabs with a single json
using tabs with a single json
hi guys,
i'm using datatable and it rocks !!
now, my coworker told me they need tabs .
i have 5 coworkers and each one need it's own tab, so i've generated a json according to the need,
problem is i need to separate those data as right now i have something like that
http://paste.laravel.com/1aMR
to be more accurate i'll details:
i have this function that fetch the data and return the json above: http://paste.laravel.com/1aMS
problem is i need to fetch the centre_id and display the data based on that id:
i have 5 centres : 191 , 194, 197, 198 and 199, they are linked to the affaires table as centre_id
so i need to fetch the id, and display the data of each id in a tab
so it'll finish with 5 tabs
and i dont know how to do that :
my js is as follow:
[code]
$(document).ready(function() {
$('#tabs').tabs({
"show": function(event, ui){
var table = $.fn.dataTable.fnTables(true);
if (table.length > 0) {$(table).datatables().fnAdjustColumnSizing();}
}
});
var oTable = $('.tblFolio').dataTable( {
"aaSorting": [[ 0, "desc" ]],
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_ Enregistrements par page"
},
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "{{ URL::to('api/do/test') }}",
"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)).html(total);
}
}
});
[/code]
i'm using datatable and it rocks !!
now, my coworker told me they need tabs .
i have 5 coworkers and each one need it's own tab, so i've generated a json according to the need,
problem is i need to separate those data as right now i have something like that
http://paste.laravel.com/1aMR
to be more accurate i'll details:
i have this function that fetch the data and return the json above: http://paste.laravel.com/1aMS
problem is i need to fetch the centre_id and display the data based on that id:
i have 5 centres : 191 , 194, 197, 198 and 199, they are linked to the affaires table as centre_id
so i need to fetch the id, and display the data of each id in a tab
so it'll finish with 5 tabs
and i dont know how to do that :
my js is as follow:
[code]
$(document).ready(function() {
$('#tabs').tabs({
"show": function(event, ui){
var table = $.fn.dataTable.fnTables(true);
if (table.length > 0) {$(table).datatables().fnAdjustColumnSizing();}
}
});
var oTable = $('.tblFolio').dataTable( {
"aaSorting": [[ 0, "desc" ]],
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_ Enregistrements par page"
},
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "{{ URL::to('api/do/test') }}",
"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)).html(total);
}
}
});
[/code]
This discussion has been closed.
Replies