且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Extjs将网格面板添加到手风琴内容

更新时间:2023-11-29 21:45:04

您不能拥有任何其他内容的HTML内容(由属性插入)。如果您添加任何项目 html 属性值不会设置/覆盖。但是肯定你可以把任何你想要的东西放在一个手风琴面板上。甚至网格。但是对于这种情况,并且基于最后一个问题,我建议您将视图引用到网格中。您可以通过使用 ComponentQuery

You cannot have html content (inserted by the property) along with any other content. If you add any item the html property value will not set/overriden. But for sure you can place anything you want into one accordion panel. Even a grid. But for that case, and based on the last question, I would recommend you to reference the view into the grid. You may do this simply by using a ComponentQuery

点击事件可以通过使用控制器的功能。

The click events can be applied by using the control function of the controller.

对于您的基本了解:

在ExtJS中,您很少使用纯HTML代码。在大多数情况下,您使用任何类型的组件。全部嵌套在items-array或dockedItem-array中。

适用于控件功能的某些查询示例

在以下中,指控制器本身。

你知道网格的Id(通常你没有这样做)。 Id是由开始的

You know the Id of the grid (normally you didn't do this). Id's are marke by a starting #

control({'#yourId': {itemclick: this.onItemclick }});

你知道xtype,只有这个类型的一个实例。您还可以使用xtypes之间的空格来描述路径。

You know the xtype and that there is only one instance of this type. You can also describe a path by using spaces between the xtypes.

control({'grid': {itemclick: this.onItemclick }});

您已经将一个自定义属性设置为网格(可以这样引用任何属性)。这一个是完全兼容的。 我在这种情况下推荐这个。

You have set a custom property to grid (you can refer any property this way). This one is fully compatible the the one above. I recommend this one in your case

control({'grid[customIdent=accordionGrid]': {itemclick: this.onItemclick }});

这只是使用ComponentQueries的一些方法,还有更多。有关更详细的解释,请参考sencha API for ComponentQuery

This are just some ways to use ComponentQueries, there are more. For a more detailed explanation you should refer the sencha API for ComponentQuery

另请注意,每个组件都实现了 up() down() 方法也支持ComponentQueries。

Also note that every component implements the up() and down() methods which also support ComponentQueries.

我忘了提到:对于控件,查询严格需要返回一个结果(只有第一个将被采用)另一方面,ComponentQuery可以返回多个结果。

I forgot to mention: For a control the query strictly need to return just one result (only the first one will be taken) a ComponentQuery on the other hand can return multiple results.