开发者

How to ref Ext.selection.CheckboxModel in ExtJS MVC?

we can ref a grid panel by:

 ref: 'grid',   selector: 'contactlist gridpanel'

but how to r开发者_开发知识库ef the CheckboxModel in the grid panel?

Any help is much appreciated!


First you should understand the concept of refs & id. refs is an array used to hold references to some ExtJS components which have id. According to documentation refs is:

One of the most useful parts of Controllers is the new ref system. These use Ext.ComponentQuery to make it really easy to get references to Views on your page.

What is id? Quoting from ExtJS documentation:

The unique id of this component instance.

id property is present for all classes that are extended from Ext.AbstractComponent. Other ExtJS class do not have this property. The value is either auto generated or assigned by the user when creating an instance of the component. It is used as a selector when you don't have object reference of the component. Also, remember that the component's HTML element will have it's id property set with the same value (either auto generated or user defined). This is done, so that you can provide custom CSS and styling of your own.

Now, coming back to refs.. it is an key/value pair array that hold a variable and selector of the component. It is not intended to hold all the references of objects in your view! In the above code, you already have a reference to the view. To get the selection model of your grid, you have to use the methods available with grid panel:

this.getGrid().getSelectionModel()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜