【问题标题】:How to add a column after some specific column in YUI data table?如何在 YUI 数据表中的某个特定列之后添加一列?
【发布时间】:2012-02-15 05:32:11
【问题描述】:

我正在使用 YUI2 数据表。 考虑以下场景。

var myColumnDefs = [ 
                { key:"A", label:"A", sortable:true},
                { key:"C", label:"C", sortable:true}
            ];


   // i want to add this column after A.
   myColumnDefs.push({ key:'B',label:'B'});

此代码将生成列 A、C、B,但我希望它是 A、B、C。我该怎么做?

【问题讨论】:

    标签: yui yui-datatable


    【解决方案1】:

    您可以在将列定义传递给 yui 数据表构造函数之前对其进行排序:

    myCOlumnDefs.sort(函数(c1, c2){

    return c1.key > c2.key ? 1 : -1;
    

    });

    【讨论】:

      猜你喜欢
      • 2011-12-17
      • 2020-03-08
      • 2013-07-06
      • 2018-05-01
      • 1970-01-01
      • 2013-03-07
      • 1970-01-01
      • 2016-12-16
      • 2021-08-15
      相关资源
      最近更新 更多