Code:
var filters = new Ext.ux.grid.GridFilters({filters:[
{type: 'numeric', dataIndex: 'form_number'},
{type: 'string', dataIndex: 'applicant'},
{type: 'string', dataIndex: 'project_number'},
{type: 'string', dataIndex: 'name'},
{type: 'date', dataIndex: 'creation_date'},
{type: 'list', dataIndex: 'status',
options: ['Eröffnet', 'small', 'medium', 'large', 'extra large'],
phpMode: true
}
]
});
var projects_store = new Ext.data.JsonStore({
url: '/grids/Project/',
fields: [],
autoLoad: true,
paramsAsHash: true,
remoteSort: true,
writer: new Ext.data.JsonWriter(),
autoSave: true,
});
// In a window as item:
this.projects_grid = new Ext.grid.GridPanel({
id: 'projects_grid',
border:false,
constrain: false,
constrainHeader: false,
width:940,
height:360,
autoScroll:true,
autoHeight:false,
cm: new Ext.grid.ColumnModel({
defaults: {
width: 150
},
listeners: {
hiddenchange: function(cm, colIndex, hidden) {
tocon("hiddenchange");
saveConfig(colIndex, hidden);
},
columnmoved: function(cm, oldIndex, newIndex) {
tocon("columnmoved");
},
configchange: function(cm) {
tocon("configchange");
}
}
}), //new Ext.grid.RowNumberer();
store: projects_store,
viewConfig: {
onDataChange: function(){
tocon("onDataChange");
this.cm.setConfig(this.ds.reader.jsonData.columns);
//making sure the focus anchor is positioned at the top left,
//so pressing a key won't make the grid jump to it's previous
//(no longer valid) position.
this.syncFocusEl(0);
}
},
bbar: new Ext.PagingToolbar({
pageSize: 30,
store: projects_store,
displayInfo: true,
displayMsg: 'Zeige Projekte {0} bis {1} von {2}',
emptyMsg: "Keine Projekte gefunden",
plugins: filters,
items: ['-',{
text: 'Lösche Filter',
iconCls: 'remove',
handler: function () {
filters.clearFilters();
}
}
]
}),
loadMask: true,
listeners: {
render: {
fn: function(){
tocon("render")
projects_store.load({
params: {
view: 'minimal',
}
});
}
}
},
plugins: [
filters,
new Ext.ux.grid.Search({
iconCls:'icon-zoom',
// ,readonlyIndexes:['note']
// ,disableIndexes:['pctChange']
minChars:2,
mode: 'remote',
autoFocus:true,
position:'top',
//menuStyle:'radio'
})
]
})