简体   繁体   English

当插入多列时,Ext JS 4.0 GridPanel CellEditing插件中断

[英]Ext JS 4.0 GridPanel CellEditing plugin breaks when multiple columns inserted

I am trying to find the proper way to dynamically add/remove columns in a GridPanel that uses CellEditing plugin in Ext JS 4.0 我试图找到一种适当的方法来动态添加/删除使用Ext JS 4.0中的CellEditing插件的GridPanel中的列

I tried to add/remove columns dynamically in a GridPanel, using the HeaderContainer add(), insert(), remove() methods 我试图使用HeaderContainer add(),insert(),remove()方法在GridPanel中动态添加/删除列

The problem is that CellEditing plugin stops working correctly when I try to add or remove more than one column: 问题是当我尝试添加或删除多个列时,CellEditing插件无法正常工作:

  1. when existing cell in edit mode the text and cursor is not visible 当现有单元格处于编辑模式时,文本和光标不可见
  2. first newly added column is not editable at all 第一个新添加的列根本不可编辑
  3. second added column is editable 第二个添加的列是可编辑的

Steps to reproduce: 重现步骤:

  1. start the page 开始页面
  2. select cell in the column to insert column position before which to add new column 在列中选择要插入列位置的单元格,然后再添加新列
  3. click add column button and type Name1 in dialog press ok 单击添加列按钮,然后在对话框中键入Name1,然后单击确定。
  4. repeat steps 2-3 Using Name2 as column name 重复步骤2-3使用Name2作为列名
  5. try to edit text in existing Company column and in column Name1 and Name2 尝试在现有的“公司”列以及“名称1”和“名称2”列中编辑文本

You can find the full source code and example here: http://jsbin.com/otorix/edit#source / http://jsbin.com/otorix/edit#preview 您可以在此处找到完整的源代码和示例: http : //jsbin.com/otorix/edit#source / http://jsbin.com/otorix/edit#preview

Can you reproduce this behavior? 您可以重现这种行为吗? Can you confirm this as bug? 您可以确认为错误吗? Or what am I doing wrong? 还是我做错了什么?

I will be grateful for any help you can provide 感谢您能提供的任何帮助

you were right, there was a bug, but apparently it was induced by the way you reconfigured your grid, I added some modifications to your code ( just for the add column) i guess the remove should be fairly easy, so my corrections: 您是对的,有一个错误,但是显然是由您重新配置网格的方式引起的,我对代码进行了一些修改(仅针对添加列),我想删除应该相当容易,因此我的更正是:

  1. the memory data for the store rangeData was an array , while the reader was expecting an Object with an array inside an items attribute (this didn't seem to cause any errors but it's much clearer this way) 商店rangeData的内存数据是一个数组,而读者期望的是在items属性内包含一个数组的Object(这似乎没有引起任何错误,但是用这种方法更加清楚)
  2. The column reconfigure was the main issue, i removed the part where you create a new column and just write the config for the new column, after that added the new column at the end of your column array, or somewhere in the middle using splice. 重新配置列是主要问题,我删除了创建新列的部分,只为新列编写了配置,然后在列数组的末尾或使用拼接的中间位置添加了新列。 The reconfigure function on the grid offers the posibility to reconfigure the store and the columns so is safer then adding the newly created column in the header container. 网格上的重新配置功能提供了重新配置商店和列的可能性,因此在将新创建的列添加到标头容器中时更加安全。

you have the modified code here http://jsbin.com/otorix/17/edit 您在这里具有修改后的代码http://jsbin.com/otorix/17/edit

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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