Giving buttons an ID
Giving buttons an ID
xtremer360
Posts: 84Questions: 2Answers: 0
I'm using the TableTools plugin and tryign to figure out how I can assign a class or id with any of my buttons.
Current Code
[code]
$( '#titles-table' ).dataTable({
"sDom": '<"top"lTf<"clear">>rt<"actions"<"actions-left"i><"actions-right"p>>',
"bAutoWidth": false,
"sPaginationType" : "full_numbers",
"oTableTools": {
"aButtons": [
{
"sExtends": "text",
"sButtonText": "Add"
},
{
"sExtends": "text",
"sButtonText": "Edit"
},
{
"sExtends": "text",
"sButtonText": "Delete"
},
]
},
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0 ] },
{ "sWidth": "20px", "aTargets": [ 0 ] },
{ "sWidth": "40px", "aTargets": [ 1 ] },
{ "sClass": "alignCenter", "aTargets": [ 1 ] }
]
});
[/code]
Current Code
[code]
$( '#titles-table' ).dataTable({
"sDom": '<"top"lTf<"clear">>rt<"actions"<"actions-left"i><"actions-right"p>>',
"bAutoWidth": false,
"sPaginationType" : "full_numbers",
"oTableTools": {
"aButtons": [
{
"sExtends": "text",
"sButtonText": "Add"
},
{
"sExtends": "text",
"sButtonText": "Edit"
},
{
"sExtends": "text",
"sButtonText": "Delete"
},
]
},
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0 ] },
{ "sWidth": "20px", "aTargets": [ 0 ] },
{ "sWidth": "40px", "aTargets": [ 1 ] },
{ "sClass": "alignCenter", "aTargets": [ 1 ] }
]
});
[/code]
This discussion has been closed.
Replies
Allan
[code]
$( '#table' ).dataTable({
"sDom": '<"top"lTf<"clear">>rt<"actions"<"actions-left"i><"actions-right"p>>',
"bAutoWidth": false,
"sPaginationType" : "full_numbers",
"oTableTools": {
"aButtons": [
{
"sExtends": "text",
"sButtonText": "Add"
},
{
"sExtends": "text",
"sButtonText": "Edit"
},
{
"sExtends": "text",
"sButtonText": "Delete",
"sButtonClass": "delete"
},
]
},
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0 ] },
{ "sWidth": "20px", "aTargets": [ 0 ] },
{ "sWidth": "40px", "aTargets": [ 1 ] },
{ "sClass": "alignCenter", "aTargets": [ 1 ] }
]
});
<?php
$tmpl = array ( 'table_open' => '' );
$data = array('name' => 'titles', 'class' => 'selectall');
$this->table->set_heading(form_checkbox($data), 'ID', 'Title Name', 'Style', 'Status');
$this->table->set_template($tmpl);
foreach ($titles as $row)
{
$checkbox_data = array(
'name' => 'titles',
'id' => $row->id
);
$this->table->add_row(form_checkbox($checkbox_data), $row->id, $row->title_name, $row->type_name, $row->status_name);
}
echo $this->table->generate();
?>
[/code]