阻止分页的jQuery数据表中的多个单选按钮选择 [英] Prevent multiple radio button selections in paginated jquery Datatables
问题描述
我在Html中使用带有分页的Jquery数据表。该单选按钮在单页中工作正常,但无法防止单选按钮在多页时出现多次选择,即,如果我在页面1中选择一个单选按钮并在页面2中选择另一个单选按钮,则两者都在仅在选定模式下。
单选按钮被称为单选,但在这里我得到了不同的行为
I am using Jquery datatables with pagination in Html. The radio button working fine in single page, but it is unable to prevent the multiple selections of radio button when it somes to multiple pages, i.e if i select one radio button in page 1 and another radio button in Page 2, then both are being in selected mode only. Radio button is known for single selection, but here I am getting different behaviour
推荐答案
我有同样的问题,我在这里找到了一篇文章:
http://datatables.net/forums/discussion/20484/how-to-avoid-multiple-radio-buttons-selection-when-paginating-a-table
I had the same problem and I found a post here: http://datatables.net/forums/discussion/20484/how-to-avoid-multiple-radio-buttons-selection-when-paginating-a-table
drawCallback函数每次切换页面时都会调用。因此,可以将当前在页面上检查的按钮的值与在另一页面上检查的按钮的值进行比较。 (您需要保存选中按钮的最后一个值。)如果它们不匹配,那么只需清除当前页面上按钮的检查属性。
"drawCallback" function will be called every time when switching pages. So it is possible to compare the value of button that is currently checked on the page to the value of button that was checked on the other page. (You need to save the last value of button checked.) If they don't match then just clear the check property of the button on current page.
希望它有帮助。
这篇关于阻止分页的jQuery数据表中的多个单选按钮选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!