数据表删除行分组 [英] datatables remove rowgrouping
本文介绍了数据表删除行分组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用DataTables Row Grouping Add-on.我通过选择框更改事件使用它.
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
});
}
});
});
我想在 index
为空时删除 rowgrouping.
I want to remove rowgrouping when the index
is empty.
谢谢.
推荐答案
我找到了解决方案 - 移除分组插件创建的绘制回调并重置分组排序:
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屋!
查看全文