ShieldUI Grid - 在运行时添加列

时间:2015-10-15 16:50:46

标签: shieldui

是否可以在运行时添加列?假设我有一组分页数据,第1页有4列,第4页有4列PLUS 1列,第3页有4列,但第2页有2列不同于第2页。 / p>

即。
第1页数据中的列并以网格显示:

File, DocName, PrintDate, Event

第2页数据中的列并以网格显示:

File, DocName, PrintDate, Event, Person

数据中的列:

File, DocName, PrintDate, Event, RunDate, Designation

网格中显示的列:

File, DocName, PrintDate, Event, Person, RunDate, Designation

当他们在页面之间来回移动时,他们都会留在网格中。

1 个答案:

答案 0 :(得分:1)

您可以通过将所有要在网格中显示的列添加到最初的所有页面来实现此目的。

然后,在加载网格时,使用此函数隐藏第一页不应显示的列: http://www.shieldui.com/documentation/grid/javascript/api/methods/hideColumn

然后附加网格寻呼机的“更改”事件句柄:

$("#grid").swidget().pager.on("change", function(e) {
    var currentPage = this.currentPage;

    // hide the cols not supposed to be visible on this page 
    // and show the rest - using the grid's hideColumn() and 
    // showColumn() functions
    // ...
});
相关问题