"Flexibility" - Using a default datatable then extenting it...
"Flexibility" - Using a default datatable then extenting it...
Here is what i am trying to do...
I have a web application with many different tables. Some have 15 columns some have 6... you get the idea. What I would like to do is have a "Base call" like:
[code]
var oTable = $('.datatable').dataTable({
"bPaginate": false,
"bProcessing": true,
"bStateSave": true,
"bJQueryUI": true,
"bAutoWidth": false,
"sDom": '<"H"TrCi>t<"F">',
"oTableTools": {
"sSwfPath": "../swf/copy_cvs_xls_pdf.swf",
"sRowSelect": "single",
"aButtons": [
{
"sExtends": "copy",
"mColumns": "visible"
},
{
"sExtends": "copy",
"mColumns": "visible",
"bSelectedOnly": "true",
"sButtonText": "Copy Selected"
},
{
"sExtends": "xls",
"mColumns": "visible"
},
{
"sExtends": "pdf",
"sPdfOrientation": "landscape",
"mColumns": "visible"
},
{
"sExtends": "print"
}
]
}
}); [/code] and then be able to customize the individual tables (EX Sorting, Grouping, KeyTable) in my application without having to have rewrite the entire method. Is that possible?
Thanks,
-Andrew
I have a web application with many different tables. Some have 15 columns some have 6... you get the idea. What I would like to do is have a "Base call" like:
[code]
var oTable = $('.datatable').dataTable({
"bPaginate": false,
"bProcessing": true,
"bStateSave": true,
"bJQueryUI": true,
"bAutoWidth": false,
"sDom": '<"H"TrCi>t<"F">',
"oTableTools": {
"sSwfPath": "../swf/copy_cvs_xls_pdf.swf",
"sRowSelect": "single",
"aButtons": [
{
"sExtends": "copy",
"mColumns": "visible"
},
{
"sExtends": "copy",
"mColumns": "visible",
"bSelectedOnly": "true",
"sButtonText": "Copy Selected"
},
{
"sExtends": "xls",
"mColumns": "visible"
},
{
"sExtends": "pdf",
"sPdfOrientation": "landscape",
"mColumns": "visible"
},
{
"sExtends": "print"
}
]
}
}); [/code] and then be able to customize the individual tables (EX Sorting, Grouping, KeyTable) in my application without having to have rewrite the entire method. Is that possible?
Thanks,
-Andrew
This discussion has been closed.
Replies
http://gregpettit.ca/2011/reusable-jquery-datatables/
I guess this is a follow up question. I have a page with 4 tabs, and each tab has a different table with different options. I want to to a FilterAll across all 4 tables but the options for the datatables needs to be different for each table.
FilterAll uses the oTable.Filterall( ); so how could i customize the tables and still use the FilterAll?
If I try to update the second table on the page fnUpdate() or fnGetPosition() will not work.