>  기사  >  웹 프론트엔드  >  ExtJs_javascript 기술에서 그리드 패널 그룹화 후 그룹 이름을 정렬하는 예제 코드

ExtJs_javascript 기술에서 그리드 패널 그룹화 후 그룹 이름을 정렬하는 예제 코드

WBOY
WBOY원래의
2016-05-16 17:11:111555검색

ExtJs_javascript 기술에서 그리드 패널 그룹화 후 그룹 이름을 정렬하는 예제 코드

复主代码 代码如下:

/**
* 내림차순으로 groupingStore를 정의
*/
var DescGroupingStore = Ext.extend(Ext.data.GroupingStore, {
groupDir : 'ASC',
groupBy : function(field, forceRegroup, 방향) {
    방향 = 방향 ? (문자열(방향)
> ) {
          return;
   }
   this.groupField = field;
   this.groupDir = 방향;
   if (this.remoteGroup) {
       if (!this.baseParams)
          this.baseParams = {};
       }
       this.baseParams['groupBy'] = field;
         this.baseParams['groupDir'] = 방향;    만약 (this.groupOnSort) {
            this.sort(필드, 방향);
            return;
      }
       if (this.remoteGroup) {
           this.reload();       } else {
            var si = this.sortInfo ||
            if (si.field != field || si.direction != 방향) {
                this.applySort();
            } else {
               this.sortData(필드, 방향);
            }
            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.groupFi 필드, 사실, this.groupDir);
            true를 반환합니다.
        } else {
            if (alwaysFireChange === true) {
               this.fireEvent('datachanged', this);
            }
            false를 반환합니다.
        }
    }
});






复主代码

代码如下:

/***************************부르다************************ *****/
// 메시지 목록 데이터 소스
var messageStore = new DescGroupingStore({
프록시: new Ext.data.HttpProxy({
url : "listMessGrid.action"
}),
리더 : myReader,
groupDir : 'DESC',
groupField : 'status',
sortInfo : {
필드 : 'id ',
방향 : "DESC"
}
})
messageStore.load();

코드 복사 코드는 다음과 같습니다.

/*****************그리드패널에 다음 속성을 추가하세요**************************** ** ********/
view : new Ext.grid.GroupingView({
showGroupName : false,
groupTextTpl : '{gvalue}:{text} ({[values.rs.length]} {[values.rs.length > ; 1 ? "폐쇄": "폐쇄"]})',
showGroupsText : "ddd"
})

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.