私はextjs4で作業しています。
グリッドにフィルターを追加したい (行または列のデータによるフィルター)
現在、データベースから取得したデータをグリッドに表示できます。
この私のコード:
Ext.define('DataEmployeeList', {
extend: 'Ext.data.Model',
fields: [
{name: 'id_emplyee', type: 'string'},
{name: 'firstname', type: 'string'},
{name: 'lastname', type: 'string'} ,
{name: 'work', type: 'string'}
]
});
var DataEmployeeListGridStore = Ext.create('Ext.data.Store', {
model: 'DataEmployeeList'
});
var DataEmployeeListGrid1 = Ext.create('Ext.grid.Panel', {
id:'DataEmployeeListGrid',
store: DataEmployeeListGridStore,
collapsible:true,
columns:
[
{xtype: 'checkcolumn', header:'display data', dataIndex: 'checked', width: 60,listeners:{'checkchange': requestGridSelectionChanged}},
{text: 'رق', flex: 1, sortable: true, hidden:true, dataIndex: 'id_employee'},
{text: 'firsname', flex: 1, sortable: true, dataIndex: 'firstname'},
{text: 'lastname', flex: 1, sortable: true, dataIndex: 'lastname'},
{text: 'work', flex: 1, sortable: true, dataIndex: 'work'}
],
columnLines: true,
anchor: '100%',
height: 250,
frame: true,
margin: '0 5 5 5',
});
function fillEmployeeList()
{
employeeService.findAllEmployee({
callback:function(list)
{
DataEmployeeListGridStore.removeAll();
if (list!=null)
{
for(var i=0; i<list.length; i++)
{
var id=list[i].idEmployee;
var firstN=list[i].firstname;
var lastN=list[i].lastname;
var workEmp= list[i].work;
DataEmployeeListGridStore.add({id_employee:id, firstname:firstN, lastname :lastN, workEmp : work});
}
}
}
});
}
Ext.onReady(function() {
fillEmployeeList();
}
私の employeeService.java :
public class employeesService{
public List<employees> getEmployeesListByLibelle() {
// TODO Auto-generated method stub
Query query = getSession().createQuery("FROM employees");
List result = query.list();
if(result.size()!=0 && result !=null)
return result;
else
return null;
}
}
すでに言ったように、正しいデータで自分の drid を表示できます。
テキストフィールドに入力されたデータに従ってグリッドをフィルタリングするために同じデータを入力するために、グリッドの上にテキストフィールドを追加したい
extjs はグリッドでフィルターを実行する可能性を提供すると思いますが、このコンテキストでは解決策が見つかりません
extjsのプラグインを使用してテキストフィールドまたはフィルターに関連する別のコンポーネントを選択して、フィルターを実行する列を選択し、テキストファイルに同じデータを入力してこのフィルターを終了できる場合の私の目標