如何在 ExtJS MVC 中引用 Ext.selection.CheckboxModel?
我们可以通过以下方式引用网格面板:
ref: 'grid', selector: 'contactlist gridpanel'
但是如何在网格面板中引用CheckboxModel?
非常感谢任何帮助!
we can ref a grid panel by:
ref: 'grid', selector: 'contactlist gridpanel'
but how to ref the CheckboxModel in the grid panel?
Any help is much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先你应该了解 refs 和 refs 的概念。 ID。 refs 是一个数组,用于保存对一些有 id 的 ExtJS 组件的引用。根据文档参考是:
id是什么?引用ExtJS文档:
id 属性适用于从 Ext.AbstractComponent 扩展的所有类。其他ExtJS类没有这个属性。该值可以是自动生成的,也可以是由用户在创建组件实例时分配的。当您没有组件的对象引用时,它用作选择器。另外,请记住,组件的 HTML 元素将其 id 属性设置为相同的值(自动生成或用户定义)。完成此操作后,您就可以提供自己的自定义 CSS 和样式。
现在,回到 refs.. 它是一个键/值对数组,保存组件的变量和选择器。它不旨在保存您视图中对象的所有引用!在上面的代码中,您已经有了对该视图的引用。要获取网格的选择模型,您必须使用网格面板提供的方法:
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:
What is id? Quoting from ExtJS documentation:
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: