I work with extjs4,
I want to add a filter in my grid ( filter by data in row or column)
Currently I can disply my grid with data retrieved from from database ,
this my code :
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();
}
my 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;
}
}
as I already said I can display my drid with the correct data ,
now I want to add a textfield above my grid in order to enter same data to filter my grid according to data entered in the textfield
I think that extjs offers the possibility to do a filter in the grid but i can't find any solution in this context
my goal if it's possible with plugin in extjs to select in textfield or in another composant related to the filter to select which column we want to do the filter and entered same data in textfiled to finish this filter