TableTools adding custom buttons more than 1
TableTools adding custom buttons more than 1
chrisdana
Posts: 0Questions: 0Answers: 0
I refer to this link :
http://datatables.net/release-datatables/extras/TableTools/plug-in.html
and try to add 2 more custom buttons but the both button trigger same event.
Do anyone have face this issue?
The code in jquery document ready is:
[code]
"oTableTools": {
"sSwfPath": "../Scripts/TableTools/swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "delete_doc",
"sButtonText": "Delete",
"sDiv": "delete",
},
{
"sExtends": "send_doc",
"sButtonText": "Send",
"sDiv": "send",
},
{
"sExtends": "copy",
"mColumns": [5, 6, 7, 8, 9, 10, 11, 12, 14]
},
{
"sExtends": "csv",
"mColumns": [5, 6, 7, 8, 9, 10, 11, 12, 14]
},
]
},
[/code]
and event code for the button are
[code]
TableTools.BUTTONS.delete_doc = $.extend( true, TableTools.buttonBase, {
"sAction":"div",
"sTag":"default",
"sToolTip":"Delete Invoices",
"sNewLine": "
",
"sButtonText": "Delete",
//"sDiv": "",
"fnClick": function( nButton, oConfig ) {
Alert("Delete");
}
});
TableTools.BUTTONS.send_doc = $.extend( true, TableTools.buttonBase, {
"sAction":"div",
"sTag":"default",
"sToolTip":"Send Invoices",
"sNewLine": "
",
"sButtonText": "Send",
//"sDiv": "send",
"fnClick": function( nButton, oConfig ) {
Alert("Send");
}
});
[/code]
Thanks for your time!
http://datatables.net/release-datatables/extras/TableTools/plug-in.html
and try to add 2 more custom buttons but the both button trigger same event.
Do anyone have face this issue?
The code in jquery document ready is:
[code]
"oTableTools": {
"sSwfPath": "../Scripts/TableTools/swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "delete_doc",
"sButtonText": "Delete",
"sDiv": "delete",
},
{
"sExtends": "send_doc",
"sButtonText": "Send",
"sDiv": "send",
},
{
"sExtends": "copy",
"mColumns": [5, 6, 7, 8, 9, 10, 11, 12, 14]
},
{
"sExtends": "csv",
"mColumns": [5, 6, 7, 8, 9, 10, 11, 12, 14]
},
]
},
[/code]
and event code for the button are
[code]
TableTools.BUTTONS.delete_doc = $.extend( true, TableTools.buttonBase, {
"sAction":"div",
"sTag":"default",
"sToolTip":"Delete Invoices",
"sNewLine": "
",
"sButtonText": "Delete",
//"sDiv": "",
"fnClick": function( nButton, oConfig ) {
Alert("Delete");
}
});
TableTools.BUTTONS.send_doc = $.extend( true, TableTools.buttonBase, {
"sAction":"div",
"sTag":"default",
"sToolTip":"Send Invoices",
"sNewLine": "
",
"sButtonText": "Send",
//"sDiv": "send",
"fnClick": function( nButton, oConfig ) {
Alert("Send");
}
});
[/code]
Thanks for your time!
This discussion has been closed.
Replies
[code] $.extend( {}, TableTools.buttonBase, {[/code]
instead of
[code] $.extend( true, TableTools.buttonBase, {[/code]
$.extend( true, {}, TableTools.buttonBase, {
[/code]
is best - deep copy into a new object.
Allan