Adding checkbox column on server-side + field search
Adding checkbox column on server-side + field search
Hi guys, I started to work with datatables and mixed up server-side datatable with live field search... but, I am not figuring out how to add a column with checkbox... I have tryied a lot of things, searched all google and couldnt find anything to help, it returns the following message:
"DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error."
looks like, its missing one data column (which is the checkbox column), and then, he moves the table content to left, where should be that column...
if you guys could take a look, thats the adress:
http://aptasd.com.br/datatable/custom/
I'm really mad about this thing...
"DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error."
looks like, its missing one data column (which is the checkbox column), and then, he moves the table content to left, where should be that column...
if you guys could take a look, thats the adress:
http://aptasd.com.br/datatable/custom/
I'm really mad about this thing...
This discussion has been closed.
Replies
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM dados' at line 2
and not json.
You can use fnRender for that column to create checkboxes, set the value depending on what is returned from the database.
the example shows using a column def to run render on one column:
http://www.datatables.net/release-datatables/examples/advanced_init/column_render.html
I just had to add another properties and get again id on the first column as value for the checkbox :)
[code]
"aoColumnDefs": [
{
"fnRender": function ( oObj ) {
return ' ';
},
"aTargets": [ 0 ]
}
]
[/code]
server_side array, got 2 times the ID
[code]
$aColumns = array('id','id', 'nome', 'email', 'descricao', 'telefone');
[/code]
it seems multi filtering doesnt work.
Use this :
[code]
$("tfoot th").keyup( function () {
/* Filter on the column (the index) of this element */
oTable.fnFilter( $(this).children("input").val(), $("tfoot th").index(this) );
} );
[/code]
instead of :
[code]
$(".search input").keyup( function (){
/* Filter on the column (the index) of this element */
oTable.fnFilter( this.value, $(".search input").index(this) );
});
[/code]
Regards,
Yusuf
now, everything is working fine.
' ';
[/code]
found this was an issue am not able to get the data,,everything that i get on the 1st and 3rd positions is undefined
can some one help me !