[英]EXTJS || Need help in implementing the Checkbox Selection Model in the GridPanel
I am facing problem while implementing the below mentioned functionality in EXTJS 4.1: 在EXTJS 4.1中实现以下提到的功能时,我遇到了问题:
I am able to create the checkboxes in the grid using CheckboxModel, but not able to proceed ahead with the requirement. 我能够使用CheckboxModel在网格中创建复选框,但无法继续进行此要求。
I have tried various examples and suggestions from the Sencha/Google, however still not able to find any solution for the same. 我已经尝试了来自Sencha / Google的各种示例和建议,但是仍然找不到相同的任何解决方案。
Any examples/pointers will be highly appreciated in this scenario. 在这种情况下,任何示例/指针都将受到高度赞赏。
This is how I would solve this problem : 这就是我解决这个问题的方法:
Next to the checkbox column put an actioncolumn with the two buttons. 在复选框列旁边,放置带有两个按钮的动作列。 Give the actioncolumn a fixed width.
给动作列固定宽度。 Set a custom style for the two items ( buttons ), like on selected show.
为两个项目(按钮)设置自定义样式,就像在选定的节目上一样。 Style the buttons with css to display only on selected rows.
使用CSS设置按钮样式,使其仅显示在选定的行上。
columns: [{
xtype: 'actioncolumn',
width: 40,
items: [{
iconCls: 'onselect-show',
...
css: CSS:
.onselect-show {display: none;} // hide
.x-grid-row-selected .onselect-show {display: inline;} // restore default
By the way, I see a contradiction in your requirements. 顺便说一下,我发现您的要求存在矛盾。 The buttons you're talking about don't make sense when more than one row is selected, but the checkbox selection model is specifically intended for multiple selection.
当选择多个行时,您正在谈论的按钮没有任何意义,但是复选框选择模型专门用于多重选择。
What about using instead onfocused-show
together with x-grid-row-focused
? 代替使用
onfocused-show
和x-grid-row-focused
呢? This would allow for multiple selections and still displaying the buttons on only one row, the one that has the focus. 这将允许进行多个选择,并且仍仅在具有焦点的一行上显示按钮。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.