ExtJs Gridpanel selection modal

2019-08-27 12:30发布

I have a two questions:

  1. How to set first row in ExtJs gridpanel as selected and
  2. How to write separate JS file for custom validations for phone nos and datefields and etc

Thanks in advance

标签: Extjs
2条回答
贪生不怕死
2楼-- · 2019-08-27 13:08

try this to select first row in grid :

Ext.getCmp('grid').getSelectionModel().selectRow(0);
查看更多
ゆ 、 Hurt°
3楼-- · 2019-08-27 13:16

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.

查看更多
登录 后发表回答