在多列中渲染 GXT RadioGroup 或 CheckBoxGroup 的元素?
我正在寻找一种在布局中渲染 GXT (GWT-Ext) RadioGroup 或 CheckBoxGroup 元素的方法,而不是单列 (Orientation.VERTICAL) 或单行 (Orientation.HORIZONTAL)。我看到 在 ExtJS 3.0 中,RadioGroups 和 CheckBoxGroups 很容易呈现在多列。但是,GXT 中似乎无法访问该配置。我在这里缺少什么吗?如果没有“简单”的解决方案,有没有办法为 RadioGroup 或 CheckBoxGroup 编写自定义渲染器?
I am looking for a way to render the elements of a GXT (GWT-Ext) RadioGroup or CheckBoxGroup in a layout other than a single column (Orientation.VERTICAL) or a single row (Orientation.HORIZONTAL). I see that in ExtJS 3.0, RadioGroups and CheckBoxGroups are easily rendered in multiple columns. However, the configuration doesn't seem to be accessible in GXT. Is there something I'm missing here? If there is no "simple" solution, is there a way to write a custom renderer for a RadioGroup or CheckBoxGroup?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
com.extjs.gxt.ui.client.widget.form.CheckBoxGroup
继承自com.extjs.gxt.ui.client.widget.form.MultiField
,其上写着API 页面说所以我认为当谈到“简单”的解决方案时你运气不好。对于复选框,我认为您可以使用多个 CheckboxGroups 和 hbox/vbox 或列布局来伪造它,但我认为它不适用于多个 RadioGroup,因为分组 Radio 具有更多含义(就哪些无线电是互斥的而言)。
com.extjs.gxt.ui.client.widget.form.CheckBoxGroup
inherits fromcom.extjs.gxt.ui.client.widget.form.MultiField
which says on its API page saysSo I think you're out of luck when it comes to a 'simple' solution. With checkboxes I think you could fake it with multiple CheckboxGroups and hbox/vbox or column layouts but I don't think it would work with multiple RadioGroup since grouping Radios has more meaning (in terms of which ones are mutual exclusive).
您可以为网格中的每一列实现 GridCellRenderer,其中每一列对应于一个单选组选项。这适用于 GXT:
You could implement
GridCellRenderer
for each column in a grid, with each column corresponding to a radiogroup choice. This will work for GXT:在不知道您正在寻找的物品的最终分布的情况下,我不知道这是否适合您;但是,您是否想过:创建一个大型 RadioGroup 或 CheckBoxGroup,然后根据需要使各个单选按钮/复选框不可见以获得您想要的模式?
如果您正在寻找多列,例如三列,每列有四个按钮,则并排使用三组,每组四个按钮。然后为每个组(假设存在一个)编写一个 OnClick() 或 OnSelect() 事件来管理这三个组,就好像它们是一个组一样。对于复选框来说这应该是微不足道的,对于单选按钮来说则有点复杂,因为一次只能选择一个单选按钮。
Without knowing the final distribution of items you are looking for I do not know if this will work for you; however, have you thought of this: Create a large RadioGroup or CheckBoxGroup then make individual radio buttons/checkboxes invisible as required to get the pattern you want?
If you are looking for multiple columns, say three colums with four buttons each, then use three groups of four buttons, side by side. Then write an OnClick() or OnSelect() event for each group (assuming one exists) to manage the three groups as if they were one. This should be trivial for checkboxes and a bit more complicated for radiobuttons since only one radiobutton should be selected at a time.
我知道这个问题已经有两年了,但我找到了解决方案:-)。
重点是将 Radio 而不是 RadioButton 添加到面板中。一些例子:
我希望它能帮助任何人:)
I know that question is 2 year old but I found solution :-).
The point is to add Radio not the RadioButton to the panel. Some example:
I hope it will help anyone :)
这是类构造函数的简单示例,它应该扩展 MultiField<复选框>班级。
那是你想要的吗?
That's simple example of constructor of your class, that should extends MultiField< CheckBox > class.
Is that you want?