I have a datatable named results. 1 column has select dropdowns which all have a class of contracts. When the table is populated, I need to have all those select boxes be checked to assure they have a value greater than 0. I need this to happen on ALL rows and not just the visible ones.
The following works, but only on the visible page:
jQuery(".contract").each(function() {
id = jQuery(this).attr('id');
val = jQuery("#"+id).val()
console.log("Preparing to check "+id+" with a value of "+val+"
");
if(val==0) {
validation(false, 'Required', 'div_'+id, 'input_'+id, false);
} else {
validation(true, '', 'div_'+id, 'input_'+id, false);
}
})
Any insight on how to get the remainder of the pages to also use this block would be appreciated. I am using the FREE version of DataTables.
UPDATE:
ok, I can get to the cells using the following:
table.column(5).nodes().to$().each(function(index) {
// jQuery(".contract").each(function() {
var cell = table.cell(this).data();
id = jQuery(cell).attr('id');
})
Within each cell is a select box with the following HTML:
<div id="div_player_20">
<div id="input_player_20">
<select id="player_20">
<option value="0" disabled="disabled">-- None --</option>
<option value="2" disabled="disabled">Lifetime</option>
<option value="1" selected="selected" disabled="disabled">7 Year</option>
<option value="3" disabled="disabled">6 Year</option>
<option value="4" disabled="disabled">5 Year</option>
<option value="5" disabled="disabled">4 Year</option>
<option value="6" disabled="disabled">3 Year</option>
<option value="7" disabled="disabled">2 Year</option>
<option value="8" disabled="disabled">1 Year</option>
<option value="9" disabled="disabled">Minor League</option>
</select>
</div>
</div>
I need to be able to get the selected value from each dropdown (including those that are off the screen)