2010-07-14 21 views
0

我在我的HTML表上使用jQuery數據表插件。jQuery datatables - fnGetHiddenNodes()示例

我想知道如何使用fnGetHiddenNodes()函數從我的表中提取特定的行。

更具體地說,
我已經將此作爲列

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"
td

td.../td

/tr

與目前的方式之一,我從這個表中提取值如下: (基本上,推隱藏字段的每行的「protCaseInst」的值,該值被登記到protCaseInstArray)

$("#mydiv-element").find("input[type='checkbox' name='caseConsent']:checked ~ input[name='protCaseInst']").each(function() { protCaseInstArray.push($(this).val()); });

使用這段代碼雖然,如果我從我的數據表第2頁選擇行,它們不會出現在我的protCaseInstArray中。

感謝,

回答

2

我想我已經有了答案。我試過

$(oTable.fnGetNodes()).find("input[@type=checkbox @name=caseConsent]:checked ~ input[name='protCaseInst']").each(function() { protCaseInstArray.push($(this).val()); });

而且它似乎工作!