国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

ExtJs中gridpanel分組后組名排序實例代碼

2019-11-20 21:32:31
字體:
來源:轉載
供稿:網(wǎng)友

復制代碼 代碼如下:

/**
  * 定義降序的groupingStore
  */
var DescGroupingStore = Ext.extend(Ext.data.GroupingStore, {
groupDir : 'ASC',
groupBy : function(field, forceRegroup, direction) {
    direction = direction ? (String(direction)
              .toUpperCase() == 'DESC' ? 'DESC' : 'ASC')
              : this.groupDir;
    if (this.groupField == field
           this.groupDir == direction && !forceRegroup) {
          return;
   }
   this.groupField = field;
   this.groupDir = direction;
   if (this.remoteGroup) {
       if (!this.baseParams) {
          this.baseParams = {};
       }
       this.baseParams['groupBy'] = field;
          this.baseParams['groupDir'] = direction;
       }
       if (this.groupOnSort) {
            this.sort(field, direction);
            return;
       }
       if (this.remoteGroup) {
            this.reload();
       } else {
            var si = this.sortInfo || {};
            if (si.field != field || si.direction != direction) {
                this.applySort();
            } else {
                this.sortData(field, direction);
            }
            this.fireEvent('datachanged', this);
        }
    },
    applySort : function() {
        Ext.data.GroupingStore.superclass.applySort.call(this);
        if (!this.groupOnSort && !this.remoteGroup) {
            if (this.groupField != this.sortInfo.field
                    || this.groupDir != this.sortInfo.direction) {
                this.sortData(this.groupField, this.groupDir);
            }
        }
    },
    applyGrouping : function(alwaysFireChange) {
        if (this.groupField !== false) {
            this.groupBy(this.groupField, true, this.groupDir);
            return true;
        } else {
            if (alwaysFireChange === true) {
                this.fireEvent('datachanged', this);
            }
            return false;
        }
    }
});

復制代碼 代碼如下:

/*************************調用***************************/
// 消息列表數(shù)據(jù)源
var messageStore = new DescGroupingStore({
    proxy : new Ext.data.HttpProxy({
        url : "listMessGrid.action"
    }),
    reader : myReader,
    groupDir : 'DESC',
    groupField : 'status',
    sortInfo : {
        field : 'id',
        direction : "DESC"
    }
});
messageStore.load();

復制代碼 代碼如下:

/*****************在gridpanel中添加如下屬性*************************************/
view : new Ext.grid.GroupingView({
    showGroupName : false,
    groupTextTpl : '{gvalue}:{text} ({[values.rs.length]} {[values.rs.length > 1 ? "封" : "封"]})',
    showGroupsText : "ddd"
})

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 西充县| 隆昌县| 龙里县| 大城县| 定安县| 武清区| 汽车| 石阡县| 桦川县| 合川市| 巴里| 绥化市| 如皋市| 石门县| 梓潼县| 邯郸县| 博野县| 囊谦县| 北川| 雷山县| 库尔勒市| 炎陵县| 祁门县| 辰溪县| 青田县| 六盘水市| 靖宇县| 三门峡市| 盘山县| 托里县| 镇巴县| 米泉市| 清徐县| 江源县| 阿拉善盟| 沈阳市| 鄂州市| 奉节县| 信阳市| 礼泉县| 枣强县|