2016-06-07 4 views
1

필터를 내 표에 적용하려고했지만이를 수행 할 수 없습니다. Extjs에 익숙하지 않아서 해결하도록 도와주세요.필터가 그리드에 표시되지 않습니다.

내가 이것을 실행 엽차 바이올린을 사용하고 난 그리드에 필터를 impement하는 로 "기능 : [필터]"시도 할 때

이 또한

Ext.require([ 
'Ext.grid.*', 
'Ext.data.*', 
'Ext.ux.grid.FiltersFeature', 
'Ext.toolbar.Paging']); 

filters = { 
    ftype: 'filters', 
    encode: encode, 
    local: local, 

    filters: [{ 
    type: 'numeric', 
    dataIndex: 'Id' 
}, { 
    type: 'string', 
    dataIndex: 'fname' 
}, { 
    type: 'string', 
    dataIndex: 'lname' 
}, { 
    type: 'date', 
    dataIndex: 'date' 
},{ 
    type: 'numeric', 
    dataIndex: 'age' 
},/*{ 
    type: 'string', 
    dataIndex: 'genderId' 
}*/,{ 
    type: 'string', 
    dataIndex: 'email' 
},{ 
    type: 'numeric', 
    dataIndex: 'phone' 
}] 
}; 

을 바라하시기 바랍니다 // 그리드

title  : 'Employee table', 
       xtype  : 'grid', 
       stripRows : true, 
       columnLines : true, 
       store  : Ext.data.StoreManager.lookup('employeeStore'), 
       width  :'100%', 
       features : [filters] 


columns: 
       [ 
        { 
        header : 'ID', dataIndex: 'Id', flex:0.5 ,filterable: true, 
        editor: 
        { 
         xtype: 'textfield', 
         allowBlank: false 
        } 
        }, 
        { 
        header : 'First Name', dataIndex: 'fname', flex:1 ,sortable : false,filterable: true, 
        filter: 
        { 
         type: 'string' 
        }, 
        editor: 
        { 
         xtype: 'textfield', 
         allowBlank: false 
        } 
       }, 
        { 
        header : 'Last Name', dataIndex: 'lname', flex:1,filterable: true, 
        editor: 
        { 
         xtype: 'textfield', 
         allowBlank: false 
        } 
        }, 
        { 
        header : 'DOB', dataIndex: 'date', flex:1,filterable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), 
        editor: 
        { 
         xtype: 'textfield', 
         allowBlank: false 
        } 
       }, 
        { 
        header : 'Gender', dataIndex: 'genderId', flex:0.5, 
        editor: 
        { 
         xtype: 'textfield', 
         allowBlank: false 
        } 
        }, 
        { 
        header : 'Age', dataIndex: 'age', flex:0.5,filterable: true, 
        editor: 
        { 
         xtype: 'textfield', 
         allowBlank: false 
        } 
        }, 
        { 
        header : 'Country', dataIndex: 'country', flex:1, 
        editor: 
        { 
         xtype: 'textfield', 
         allowBlank: false 
        } 
        }, 
        { 
        header : 'Email', dataIndex: 'email', flex:2,filterable: true, 
        editor: 
        { 
         xtype: 'textfield', 
         allowBlank: false 
        } 
        }, 
        { 
        header : 'Phone', dataIndex: 'phone', flex:1,filterable: true, 
        editor: 
        { 
         xtype: 'textfield', 
         allowBlank: false 
        } 
        } 
       ], 
+0

일부 자료가 누락 링크에 보이는 당신이 응용 프로그램의 새로 고침을 할 수 있으며, 다시 시도하십시오. – UDID

+0

Ext.ux.grid.FiltersFeature에이 파일이 있는지 여부를 확인 했습니까? 또한 어떤 Ext JS 버전을 사용하고 있습니까? –

+0

예 플러그인이 존재하고 4.2.1 버전을 사용 중입니다 –

답변

0

extjs 6 버전을 사용하는 경우 아래 코드가 유용합니다. 필터를 표시하려면 그리드에 'gridfilters'플러그인을 제공해야합니다.

VAR 그리드 = Ext.create ('Ext.grid.Panel', { 제목 : 'Employee 테이블', stripRows : 사실, columnLines : 사실, 가기 : Ext.data.StoreManager.lookup (' employeeStore '), 폭 :'100 % ', 플러그인 :.'gridfilters ',

 columns: 
      [ 
       { 
       header : 'ID', dataIndex: 'Id', flex:0.5 ,filterable: true, 
       editor: 
       { 
        xtype: 'textfield', 
        allowBlank: false 
       }, 
       filter: 
       { 
        type: 'numeric' 
       } 
       }, 
       { 
       header : 'First Name', dataIndex: 'fname', flex:1 ,sortable : false,filterable: true, 
       filter: 
       { 
        type: 'string' 
       }, 
       editor: 
       { 
        xtype: 'textfield', 
        allowBlank: false 
       } 
      }, 
       { 
       header : 'Last Name', dataIndex: 'lname', flex:1,filterable: true, 
       editor: 
       { 
        xtype: 'textfield', 
        allowBlank: false 
       }, 
      filter: 
       { 
        type: 'string' 
       } 
       }, 
       { 
       header : 'DOB', dataIndex: 'date', flex:1,filterable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), 
       editor: 
       { 
        xtype: 'textfield', 
        allowBlank: false 
       }, 
     filter: 
       { 
        type: 'date' 
       } 

      }, 
       { 
       header : 'Gender', dataIndex: 'genderId', flex:0.5, 
       editor: 
       { 
        xtype: 'textfield', 
        allowBlank: false 
       }, 
     filter: 
       { 
        type: 'string' 
       } 
       }, 
       { 
       header : 'Age', dataIndex: 'age', flex:0.5,filterable: true, 
       editor: 
       { 
        xtype: 'textfield', 
        allowBlank: false 
       }, 
     filter: 
       { 
        type: 'numeric' 
       } 
       }, 
       { 
       header : 'Country', dataIndex: 'country', flex:1, 
       editor: 
       { 
        xtype: 'textfield', 
        allowBlank: false 
       }, 
     filter: 
       { 
        type: 'numeric' 
       } 
       }, 
       { 
       header : 'Email', dataIndex: 'email', flex:2,filterable: true, 
       editor: 
       { 
        xtype: 'textfield', 
        allowBlank: false 
       }, 
     filter: 
       { 
        type: 'string' 
       } 
       }, 
       { 
       header : 'Phone', dataIndex: 'phone', flex:1,filterable: true, 
       editor: 
       { 
        xtype: 'textfield', 
        allowBlank: false 
       }, 
     filter: 
       { 
        type: 'numeric' 
       } 
       } 
      ] 
    }); 

실행 예 Grid Filters

+0

Shrinatha는 효과가 있었지만 작동하지 않을 격자 내 기능에 "필터"변수를 삽입하려고했을 때 –

+0

경로 로더를 설정하십시오. 프로젝트의 ux 폴더 경로를 로더''Ext.Loader.setConfig ({enabled : true}); Ext.Loader.setPath ('Ext.ux', '../ ux'); '예제를 참조 할 수 있습니다. [http://docs.sencha.com/extjs/4.2.4/extjs-build/examples/grid -filtering/grid-filter-local.html]을 참조하십시오. 또한 로컬에 값을 지정하고 config를 부울로 인코딩합니다. – Shrinath

관련 문제