Extjs将网格面板添加到手风琴内容 [英] Extjs add grid panel to accordion content

查看:135
本文介绍了Extjs将网格面板添加到手风琴内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实际上不知道这是否可行,但是我也会问。我有一组手风琴控制,在每个内容的内容中,我需要显示一个网格面板。网格面板需要附加一个点击事件。我已经尝试过简单地创建网格面板并设置手风琴的html属性,但是这不会产生任何内容。

I'm actually not sure if this is possible, but I will ask it anyway. I have a group of accordion controls, and within the content body of each I need to display a grid panel. The grid panel needs to have a click event attached to it. I have tried simply creating the grid panel and setting the html property of the accordion to it, but this produces no content.

有没有可以实现上述? / p>

Is there somehow I can achieve the above?

推荐答案

您不能拥有任何其他内容的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.

这篇关于Extjs将网格面板添加到手风琴内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆