Extjs 4.x用按钮向上/向下移动网格记录
这篇文章是我较早的帖子的延续(在这里)我找不到工作解决方案(尚未)。简而言之: 我创建了一个Extjs(4.x)网格,该网格具有父母和孩子的记录。记录按顺序排序,在儿童中总是出现在父母下方,如下所示,“ p”将记录指定为父母,而“ c”将记录指定为儿童的记录。
“梅”是彼得的父母,奥丁是雷神和洛基的父母,布鲁斯还没有孩子被标记为父母(独立实体)
fiddle: https://fiddle.sencha.com/#view/#view/editor&eeditor&amp.fiddle/3jks
我希望更改排序的顺序当我上升/下降时,父母还带着孩子。起初,我想尝试拖放,但找不到一个工作解决方案(我尝试了Gird DragandDrop以及TreeGrid,Fiddles在我以前的 post )。
根据上一篇公开帖子的建议,我尝试对哪些小组和孩子进行分组,但我失去了拖放整个小组的能力。为了使用我创建的知识,我可以根据用户单击来向上或向下移动组。该分组基于等级列,因此,一旦我更新等级,记录应该理想地跳跃组。由于某种原因,当我在排名上单击“向上”按钮时:2组,布鲁斯更改为排名:1,梅·帕克(May Parker)更改为排名:2是正确的,但彼得·帕克(Peter Parker)仍然保持在等级:1。在调试代码之后,我发现商店出于某种原因将彼得的记录删除,并用另一份May Parker替换了(尽管网格没有显示)。我输入了控制台消息,我们可以观察到这一点。这里有什么问题?非常感谢指针和建议。如果有更好的方法可以根据等级移动这些记录,我也可以更改整个逻辑。
This post is continuation of my earlier post (here) for which I couldnt find a working solution (yet). In brief:
I have created a Extjs (4.X) grid which has records of parents and childrens. The records are in sorted order where in the childrens always appear just below their parents as shown here, where 'P' designates a record as parent while 'C' designates a record as children.
'May' is the parent of Peter, Odin is the parent of Thor and Loki, Bruce has no children yet marked as Parent (standalone entity)
fiddle: https://fiddle.sencha.com/#view/editor&fiddle/3jks
I wish to change sort order of the parents while also bringing their childrens along when I move the groups up/down. At first I wanted to try drag and drop but I couldnt find a working solution for that (I tried Gird DragAndDrop as well as TreeGrid, fiddles are on my previous post).
Based on a suggestion on the previous open post I tried Grouping which groups parent and child but I lost the ability to drag and drop the entire group. To work with what knowledge I have I have created buttons instead, for moving the groups up or down based on the user click. The grouping is based on Rank column so as soon as I update the rank the records should ideally jump groups. For some reason when I click on "UP" button on the Rank:2 group, BRUCE changes to Rank:1 and May Parker changes to Rank:2 which is correct but the Peter Parker still stays at Rank:1. After debugging the code I found that the store for some reason removed Peter's records and replaced it with another copy of May Parker (the grid doesnt show it though). I have put console messages where we can observe this. What could be the problem here? Pointers and suggestions are very much appreciated. I am open to changing the entire logic as well if there is a better way to move these records based on rank.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个工作 fiddle 用于GRID GROUPER drag-Drop。
以下是更多详细信息,有助于建立您的上下按钮示例:
您正在多次更新记录。
我建议您通过RecordID设置排名,以确保仅处理一次每个项目。否则,在您处理它们时,记录切换组。
Here is a working fiddle for grid grouper header drag-drop.
Here are more details and some help to build your up-down button example:
You are updating the records several times.
I would suggest, that you set the rank by recordId to ensure each item is processed only once. Otherwise records switch groups while you are working on them.