jQuery datatables - fnGetHiddenNodes() example
I'm using jQuery datatables plug-in on my HTML Table.
I wanted to know how do I go about using the fnGetHiddenNodes() function to extract a particular row from my table.
More specifically,
I've this as one of the columns
tr
td align="center"
input type="checkbox" id="caseConsent(index)" name="caseConsent"
input type="hidden" id="protCaseInst(index)" name="protCaseInst" value="some value here..unique to each row"
t开发者_如何学God
td.../td
/tr
And currently the way, I'm extracting values from this table is as follows: (Basically, push the value of hidden field 'protCaseInst' of each row that is checked into protCaseInstArray)
$("#mydiv-element").find("input[type='checkbox' name='caseConsent']:checked ~ input[name='protCaseInst']").each(function() {
protCaseInstArray.push($(this).val());
});
Using this code though, if I select rows from 2nd page of my datatable, they don't appear in my protCaseInstArray.
Thanks,
I think I already have the answer. I tried
$(oTable.fnGetNodes()).find("input[@type=checkbox @name=caseConsent]:checked ~ input[name='protCaseInst']").each(function() { protCaseInstArray.push($(this).val()); });
And it seems to work!
精彩评论