$("exportchk").setAttribute('checked');
$('#check_all').click( function() {
$('input', oTable.fnGetNodes()).attr('checked',this.checked);
} );
"fnInitComplete" : function () {$('#check_all').click( function() {$('input', oTable.fnGetNodes()).attr('checked',this.checked);});}
$('#check_all').click( function() {
var oTable = $('#MYTABLEID').dataTable();
$('input', oTable.fnGetFilteredNodes()).attr('checked',this.checked);
} );
<input type="checkbox" id="check_all"/>
"fnInitComplete" : function () {$('#check_all').click( function() {$('input[name*=\'selected\']', oTable.fnGetNodes()).attr('checked',this.checked);});},
listTable = $('#recordlist-table').dataTable({
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"sPaginationType": "full_numbers",
"oLanguage": { "sSearch": "Search Record:"},
"oLanguage": { "sZeroRecords": "No matching Record(s) found" }
});
$('#idAnalogCheckBox').click( function() {
var oTable = $('#recordlist-table').dataTable();
if ($('#idAnalogCheckBox').attr('checked'))
{
$('INPUT[name=\'analogType\']', oTable.fnGetNodes()).attr('checked',this.checked);
}
else
{
$('INPUT[name=\'analogType\']', oTable.fnGetNodes()).removeAttr('checked');
}
});
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
<thead>
<tr>
<th style="background-attachment: fixed;"><input type="checkbox" id="check_all" name="check_all" class="checkall" value="ON"></th>
<th><?php echo JText::_('COM_RECHERCHECRE_RESULTAT_COL2'); ?></th>
<th><?php echo JText::_('COM_RECHERCHECRE_RESULTAT_COL3'); ?></th>
<th><?php echo JText::_('COM_RECHERCHECRE_RESULTAT_COL4'); ?></th>
<th><?php echo JText::_('COM_RECHERCHECRE_RESULTAT_COL5'); ?></th>
</tr>
</thead>
<tbody>
<?php
if(count($this->resultat)>0){
echo count($this->resultat);
foreach ($this->resultat as $key => $value){
$doc = '-';
if(@fopen('/data/www/iods/images/documentation/'.strtolower($value['cre_doc_link']).'.pdf',"r")){
$doc = '<a target="_blank" href="/images/documentation/'.strtolower($value['cre_doc_link']).'.pdf" ><img src="'.$this->baseurl.'/media/com_recherchecredit/images/pdficon17x17.png"/></a>';
}
echo '<tr class="gradeU">';
echo '<th><input type="checkbox" name="ligne_serie" class="checkers" value="'.$value['cre_id_serie'].'" id="id_serie='.$value['cre_id_serie'].'"></th>';
echo '<td>'.$value['acr_label_'.$langue].'</td>';
echo '<td>'.$value['cre_id_serie'].'</td>';
echo '<td>'.$value['cre_label_serie'].'</td>';
echo '<td align="center">'.$doc.'</td>';
echo '</tr>';
}
}
$(document).ready(function() {
oTable = $('#example').dataTable( {
"aLengthMenu": <?php echo JText::_('COM_RECHERCHECRE_RESULTAT_DATATABLES_LENGTHMENU'); ?> ,
"oLanguage": {
"sProcessing": "<?php echo JText::_('COM_RECHERCHECRE_RESULTAT_DATATABLES_SPROCESSING'); ?>",
"sLengthMenu": "<?php echo JText::_('COM_RECHERCHECRE_RESULTAT_DATATABLES_SLENGTHMENU'); ?>",
"sZeroRecords": "<?php echo JText::_('COM_RECHERCHECRE_RESULTAT_DATATABLES_SZERORECORDS'); ?>",
"sEmptyTable": "<?php echo JText::_('COM_RECHERCHECRE_RESULTAT_DATATABLES_SEMPTYTABLE'); ?>",
"sLoadingRecords": "<?php echo JText::_('COM_RECHERCHECRE_RESULTAT_DATATABLES_SLOADINGRECORDS'); ?>",
"sInfo": "<?php echo JText::_('COM_RECHERCHECRE_RESULTAT_DATATABLES_SINFO'); ?>",
"sInfoEmpty": "<?php echo JText::_('COM_RECHERCHECRE_RESULTAT_DATATABLES_SINFOEMPTY'); ?>",
"sInfoFiltered": "<?php echo JText::_('COM_RECHERCHECRE_RESULTAT_DATATABLES_SINFOFILTERED'); ?>",
"sInfoPostFix": "",
"sSearch": "<?php echo JText::_('COM_RECHERCHECRE_RESULTAT_DATATABLES_SSEARCH'); ?>",
"sUrl": "",
"oPaginate": {
"sFirst": "<?php echo JText::_('COM_RECHERCHECRE_RESULTAT_DATATABLES_SFIRST'); ?>",
"sPrevious": "<?php echo JText::_('COM_RECHERCHECRE_RESULTAT_DATATABLES_SPREVIOUS'); ?>",
"sNext": "<?php echo JText::_('COM_RECHERCHECRE_RESULTAT_DATATABLES_SNEXT'); ?>",
"sLast": "<?php echo JText::_('COM_RECHERCHECRE_RESULTAT_DATATABLES_SLAST'); ?>"
},
"fnInfoCallback": null
}
} );
} );
$('#check_all').click( function() {
$('input', oTable.fnGetNodes()).attr('checked',this.checked);
} );
checkedCheckboxes = $("input:checked", yourDataTableVariable.fnGetNodes()).map(function(){
return this.id
});
Joyrex January 10
Posts: 13
This thread has been incredibly helpful in solving the issue of checking checkboxes that are not visible on the current page, and the above code works - however, one thing that still remains (and frankly I'm surprised nobody mentioned it here) is those hidden checked checkboxes do not get submitted when using it in a form - any ideas?
It looks like you're new here. If you want to get involved, click one of these buttons!
Get useful and friendly help straight from the source.