数据表删除行组 [英] datatables remove rowgrouping
本文介绍了数据表删除行组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 DataTable行分组加载项。我使用它通过选择框更改事件。
I am using DataTables Row Grouping Add-on. I used it by select box change event.
代码
在PHP中:
<select id="Group-Discoveries" name="Group-Discoveries" class="input-medium">
<option value="">None</option>
<option value="6">Domain</option>
<option value="7">Type</option>
<option value="8">Category</option>
<option value="9">Status</option>
</select>
在JS中:
$(document).ready(function() {
var DTable = $('#discovery').dataTable( {
"sDom": "<'row-fluid'<'span3'<'toolbar'>><'span3'<'selectbar'>><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"bPaginate": false
});
$('#Group-Discoveries').live('change', function(){
var index = $(this).val();
if(index == ''){
}
else{
DTable.rowGrouping({
"iGroupingColumnIndex": index,
"bHideGroupingColumn": false,
"bHideGroupingOrderByColumn": false,
"sGroupingClass":"group_"+index,
"bSetGroupingClassOnTR":true,
"bExpandableGrouping":true
});
}
});
});
我想在索引中删除行组
为空。
I want to remove rowgrouping when the index
is empty.
谢谢。
推荐答案
p>我找到解决方案 - 删除分组插件创建并重置组排序的绘图回调:
I found the solution - remove the draw callback that the grouping plugin creates and reset the group sorting:
var oSettings = jQuery('#table').dataTable().fnSettings();
for (f = 0; f < oSettings.aoDrawCallback.length; f++) {
if (oSettings.aoDrawCallback[f].sName == 'fnRowGrouping') {
oSettings.aoDrawCallback.splice(f, 1);
break;
}
}
oSettings.aaSortingFixed = null;
希望这有帮助。
这篇关于数据表删除行组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文