Select all check box
Select all check box
pracede2005
Posts: 10Questions: 0Answers: 0
I use datatable to display some data. Below the datatables table, i have a button "Tout selectionner" , When this button is clicked all check box must be selected but it does not work. Here is my code :
[code]
$(document).ready(function() {
oTable = $('#parameterList').dataTable( {
//"bServerSide": true,
"sAjaxSource":'/OCC/json/LoadPerimetre.action?'+params, // URL d'appel pour recuperer les datas json
"aoColumns": [ // definition de l'ordre et la largeur des colonnes
{ "mData": "nomGroupe","sWidth": "20%" },
{ "mData": "nomSousGroupe1","sWidth": "10%" },
{ "mData": "nomEntreprise","sWidth": "40%" },
{ "mData": "siren","sWidth": "25%" },
{ "mData": "selection","sWidth": "5%" }
]
} );
$('#selectAll').click( function() {
$('input', oTable.fnGetNodes()).attr('checked',this.checked);
} );
});
[/code]
My button code is :
[code]
[/code]
When i click in the button nothing is selected. But if a check a checkbox and click on the button selected become unselect.
Someone could help me ?
Thanks
[code]
$(document).ready(function() {
oTable = $('#parameterList').dataTable( {
//"bServerSide": true,
"sAjaxSource":'/OCC/json/LoadPerimetre.action?'+params, // URL d'appel pour recuperer les datas json
"aoColumns": [ // definition de l'ordre et la largeur des colonnes
{ "mData": "nomGroupe","sWidth": "20%" },
{ "mData": "nomSousGroupe1","sWidth": "10%" },
{ "mData": "nomEntreprise","sWidth": "40%" },
{ "mData": "siren","sWidth": "25%" },
{ "mData": "selection","sWidth": "5%" }
]
} );
$('#selectAll').click( function() {
$('input', oTable.fnGetNodes()).attr('checked',this.checked);
} );
});
[/code]
My button code is :
[code]
[/code]
When i click in the button nothing is selected. But if a check a checkbox and click on the button selected become unselect.
Someone could help me ?
Thanks
This discussion has been closed.
Replies
Allan
Before
[code][/code]
After
[code][/code]
Is it normal ?
Now it's working with check box instead of button.
i think this is what you want http://jsfiddle.net/dstarh/MDqA7/