I have a two questions:
- How to set first row in ExtJs gridpanel as selected and
- How to write separate JS file for custom validations for phone nos and datefields and etc
Thanks in advance
I have a two questions:
Thanks in advance
Assuming you have an instance of your grid, you can select the row using selectFirstRow()
. Here is the sample code:
grid.getSelectionModel().selectFirstRow();
You can move your custom validations to another file. All you need to move your
Ext.apply(Ext.form.VTypes, {
daterange : function(val, field) {
var date = field.parseDate(val);
...
}
});
to separate file. and ensure that the js file is included.
try this to select first row in grid :
Ext.getCmp('grid').getSelectionModel().selectRow(0);