简体   繁体   English

在指定的索引处将行添加到ListGrid Smart GWT

[英]Adding row to a ListGrid at a specified index Smart GWT



Currently I'm working on a listgrid which is editable and my requirement is to create aa new row every time a user selects a row and presses the "Create" Button. 目前,我正在研究一个可编辑的列表网格,我的要求是每次用户选择一行并按下“创建”按钮时都创建一个新行。 The new row needs to be added immediately below the selected row. 新行需要立即添加到所选行的下方。 I tried using the below method 我尝试使用以下方法

ListGrid.getRecordList().addAt(ListGridRecord rec, Index index) ListGrid.getRecordList()。addAt(ListGridRecord rec,Index index)

However I got the warning message 但是我收到了警告消息

15:48:04.373:MUP3:WARN:Log:ResultSets are readonly. 15:48:04.373:MUP3:WARN:Log:ResultSets是只读的。 This operation (addAt) will be ignored. 此操作(addAt)将被忽略。

I've searched the smartgwt showcase to look for ways to edit a grid , so that new row is added at a specified index, however I wasn't able to find anything suitable. 我搜索了smartgwt展示柜,以寻找编辑网格的方法,以便在指定的索引处添加新行,但是找不到任何合适的行。

I got to know that ResultSets is getting created because I'm using the statement ListGrid.fetchData() Is there any way to solve this issue? 我知道正在创建ResultSets,因为我正在使用语句ListGrid.fetchData()有什么方法可以解决此问题? Any suggestion is highly appreciated! 任何建议,高度赞赏!

Muchas Gracias. Muchas Gracias。

Figured it out, quite a weird trick...but works for me... what you need to do is use grid.setRecords(grid.getRecords()); 弄清楚了,这是一个很奇怪的技巧...但是对我有用...您需要做的是使用grid.setRecords(grid.getRecords()); just before grid.getRecordList().addAt(rec, index); 就在grid.getRecordList()。addAt(rec,index);之前 I think doing this makes the ResultSet editable. 我认为这样做可以使ResultSet可编辑。

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

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