ExtJs Gridpanel selection modal

倾然丶 夕夏残阳落幕 提交于 2019-12-13 05:17:23

问题


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


回答1:


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.




回答2:


try this to select first row in grid :

Ext.getCmp('grid').getSelectionModel().selectRow(0);


来源:https://stackoverflow.com/questions/5830364/extjs-gridpanel-selection-modal

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!