用Dynatable中的隐藏列排序 [英] Sorting with hidden columns in Dynatable

查看:118
本文介绍了用Dynatable中的隐藏列排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Dynatable在表中显示ajax数据.该表有很多列,因此为了更易于理解,我有一些按钮只能一次显示某些列.在我尝试按列排序之前,该方法一直有效,直到它取消隐藏其他列为止.我已经尝试在此jsfiddle 中复制该问题.可动态化的部分非常简单,尽管我必须复制标题类以便在单击右键时隐藏相应的列:

$('#my-final-table').dynatable({
  dataset: {
    records: jsondata
  },
  table: {
    copyHeaderClass: true
  }
});

正如您在jsfiddle中看到的那样,如果您隐藏一些列(使用按钮),然后按其余列之一进行排序,则所有隐藏的列都会重新出现.

还有其他人可以使用Dynatable的sort函数同时隐藏某些列吗?

非常感谢, 亚历克斯

解决方案

在Dynatable中我找不到运维解决方案,因此我切换到数据表,在其中对隐藏的列进行排序似乎不是问题.

I'm using Dynatable to display ajax data in a table. The table has lots of columns, so to make it easier to understand I have buttons to only show certain columns at one time. That works find until I try to sort by a column, at which point it unhides the other columns. I've tried to replicate the problem in this jsfiddle. The dynatable part of it is pretty straight forward, although I have to copy header classes in order for it to hide the corresponding columns when the right buttons are clicked:

$('#my-final-table').dynatable({
  dataset: {
    records: jsondata
  },
  table: {
    copyHeaderClass: true
  }
});

As you can see with the jsfiddle, if you hide some of the columns (using the buttons) and then sort by one of the remaining columns, all of the hidden columns reappear.

Has anyone else gotten Dynatable's sort function to work while also hiding some of the columns?

Thanks a lot, Alex

解决方案

I had no luck finding a solution to this in Dynatable, so I switched over to Datatables, where sorting hidden columns doesn't seem to be an issue.

这篇关于用Dynatable中的隐藏列排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆