API to add or disable a button
API to add or disable a button
I was trying to disable, add, or remove buttons.
[code]
"oTableTools": {
"sRowSelect": "multi",
"aButtons": [
{ "sExtends": "editor_create", "editor": editor },
{ "sExtends": "editor_edit", "editor": editor },
{ "sExtends": "editor_remove", "editor": editor }
]
}
[/code]
I would like to be able to delete, add or hide the buttons but was unsure of what collection the belong to!
I was guessing
[code]
$(dataTable.oTableTools.('editor_create').update());
[/code]
or
[code]
$(editor.oTableTools.('editor_create').update());
[/code]
Thanks in advance.
[code]
"oTableTools": {
"sRowSelect": "multi",
"aButtons": [
{ "sExtends": "editor_create", "editor": editor },
{ "sExtends": "editor_edit", "editor": editor },
{ "sExtends": "editor_remove", "editor": editor }
]
}
[/code]
I would like to be able to delete, add or hide the buttons but was unsure of what collection the belong to!
I was guessing
[code]
$(dataTable.oTableTools.('editor_create').update());
[/code]
or
[code]
$(editor.oTableTools.('editor_create').update());
[/code]
Thanks in advance.
This discussion has been closed.
Replies
Allan
Allan
.... "oTableTools": {
"sRowSelect": "single",
"aButtons": [
{ "sExtends": "editor_create", "editor": editor, "sButtonText":"Add Specialty","fnClick":function(nButton, oConfig, oFlash){alert("You may not add specialties because thid doctor is not in your practice");return;} }},
{ "sExtends": "editor_remove", "editor": editor, "sButtonText":"Remove Specialty","fnClick":function(nButton, oConfig, oFlash){alert("You may not remove specialties because thid doctor is not in your practice");return;} }
]
}
} );
If you are using PHP to control how you are putting the javascript into the page, you can controll it with a php var like this:
//your conditions want it enabled.
$dataTablesAddSpecialtyButtonDisabler = "";
//your conditions want it disabled.
$dataTablesAddSpecialtyButtonDisabler = ",\"fnClick\":function(nButton, oConfig, oFlash){alert(\"You may not add specialties because this doctor is not in your practice\");return;}";
//then put this into where you define the two buttons in the javascript in php.
{ "sExtends": "editor_create", "editor": editor, "sButtonText":"Add Specialty"'.$dataTablesAddSpecialtyButtonDisabler.' },
{ "sExtends": "editor_remove", "editor": editor, "sButtonText":"Remove Specialty"'.$dataTablesRemoveSpecialtyButtonDisabler.' }