简体   繁体   English

EXTJS || 在GridPanel中实现复选框选择模型时需要帮助

[英]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中实现以下提到的功能时,我遇到了问题:

  1. I have implemented Ext.selection.CheckboxModel to enable the user to select any row from the existing rows in the GridPanel. 我已经实现了Ext.selection.CheckboxModel,以使用户能够从GridPanel中的现有行中选择任何行。
  2. On click of the check box of this selection model the User will be prompt with EDIT & DELETE buttons alongside the checkbox in the grid itself. 单击此选择模型的复选框后,将在网格本身的复选框旁边显示“ 编辑和删除”按钮,提示用户。
  3. On clicking EDIT , the data from the respective(checked) row will move to the below FormPanel. 单击“编辑”后 ,相应(已选中)行中的数据将移至下面的FormPanel。 Thus giving user the privilege to alter the entered data. 因此,授予用户更改输入数据权限。
  4. On clicking DELETE , the respective(checked) row will be deleted from the GridPanel . 单击DELETE时将从GridPanel中删除相应的(选中的)行。

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-showx-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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM