extjs 매거 유형

1270 단어 staticenumext4extjs
열거 클래스 코드:
Ext.define('Soims.model.application.ApplicationState', {
    statics: { //   
        Unknown: { value: 'Unknown', name: '    ' },
        Deleted: { value: 'Deleted', name: '   ' },
        UnSubmit: { value: 'UnSubmit', name: '   ' },
        Submit: { value: 'Submit', name: '   ' }
    }
});

열거 유형 호출하기
Ext.define("Soims.view.application.ApplicationGrid", {
    extend: 'Ext.grid.Panel',
    requires: 'Soims.model.application.ApplicationState', //     
    alias: 'widget.applicationgrid',
    title: '     ',
    closable: true,
    selType: 'rowmodel',
    initComponent: function () {
        this.columns = [
           {
               header: 'id',
               dataIndex: 'id',
               flex: 1,
               hidden: true
           }, {
               header: '    ',
               dataIndex: 'state',
               flex: 1,
               renderer: function (value) {
                   return Soims.model.application.ApplicationState[value].name; // key-value
               }
           }];
        this.callParent();
    }
});

좋은 웹페이지 즐겨찾기