Ext.define('School.view.StudentGrid',
{
extend: 'Ext.grid.Panel',
alias: 'widget.StudentGrid',
id: 'studentsGrid',
config: {},
constructor: function (config) {
this.initConfig(config);
return this.callParent(arguments);
},
width: '100%',
height: 300,
selType: 'rowmodel',
selModel:
{
mode: 'SINGLE'
},
viewConfig:
{
stripeRows: true
},
initComponent: function () {
Ext.apply(this,
{
store: 'School.store.Student',
columns: [{
text: "Id",
dataIndex: 'Id',
hidden: false,
width: 35
},
{
text: "First Name",
flex: 1,
dataIndex: 'firstName',
editor:
{
// defaults to textfield if no xtype is supplied
allowBlank: false
}
},
{
text: "Middle Name",
flex: 1,
dataIndex: 'middleName',
editor:
{
// defaults to textfield if no xtype is supplied
allowBlank: true
}
},
{
text: "Last Name",
flex: 1,
dataIndex: 'lastName',
editor:
{
// defaults to textfield if no xtype is supplied
allowBlank: true
}
},
{
text: "Birth Date",
flex: 1,
dataIndex: 'birthDate',
editor:
{
xtype: 'datefield',
format: 'd-m-Y',
allowBlank: true
},
renderer: Ext.util.Format.dateRenderer('d-m-Y')
},
{
text: "City",
flex: 1,
dataIndex: 'city',
editor:
{
// defaults to textfield if no xtype is supplied
allowBlank: true
}
},
{
text: "State",
flex: 1,
dataIndex: 'state',
editor:
{
// defaults to textfield if no xtype is supplied
allowBlank: true
}
}],
bbar: {
xtype: 'pagingtoolbar',
store: 'School.store.Student',
displayInfo: true,
displayMsg: 'Displaying {0} to {1} of {2} records ',
emptyMsg: "No records to display "
}
});
this.callParent(arguments);
}
});