PDA

View Full Version : store.remove() fails on single record



waffle
31 Jan 2017, 5:55 PM
Can anyone suggest why remove() on the store backing a grid would fail to remove a record when it is the only one in the store?

Gary Schlosberg
1 Feb 2017, 2:31 PM
Are you passing the record as an argument to remove()?

waffle
1 Feb 2017, 7:09 PM
I have tried both the index and the record. If there are multiple records, remove succeeds until there is only one left.

Gary Schlosberg
2 Feb 2017, 8:20 AM
Strange. Does this only affect remove() or is removeAll() leaving a remainder as well? Is there any filtering on this grid?

waffle
2 Feb 2017, 2:08 PM
I tried removeAll and saw the same problem. There is no filtering. Funny thing is this problem didn't appear at first - some change caused it to manifest. What is going on here is that as you clck on rows in grid A they are transferred to grid B. At first it worked fine and I could transfer all the rows. Now when there is one row it appears in grid B but is not removed from A and remains highlighted. I can see in the debugger that there is still Array[1] in the store.

Gary Schlosberg
2 Feb 2017, 3:04 PM
By any chance does the record have the phantom flag set to true?

waffle
2 Feb 2017, 3:33 PM
I tried removeAll and saw the same problem. There is no filtering. Funny thing is this problem didn't appear at first - some change caused it to manifest. What is going on here is that as you clck on rows in grid A they are transferred to grid B. At first it worked fine and I could transfer all the rows. Now when there is one row it appears in grid B but is not removed from A and remains highlighted. I can see in the debugger that there is still Array[1] in the store.

Gary Schlosberg
3 Feb 2017, 8:16 AM
Does the remaining record have the phantom flag set to true?

waffle
8 Feb 2017, 9:42 AM
I'll check - when does this get set and what is the effect?

Gary Schlosberg
8 Feb 2017, 2:25 PM
It's a property on the model:
http://docs.sencha.com/extjs/4.2.6/#!/api/Ext.data.Model-property-phantom

waffle
1 Mar 2017, 7:25 AM
The record is not a phantom. Update: I can remove the last record from the store but it remains visible in the grid even after reconfigure()

Gary Schlosberg
1 Mar 2017, 12:00 PM
Are you able to recreate this issue in a test case?
https://fiddle.sencha.com/#view/editor

waffle
1 Mar 2017, 1:25 PM
I don't know whether I can extract the relevant pieces - I'll have a look.

waffle
6 Mar 2017, 9:04 PM
Solution:
I noticed that when there is one row left in the grid and it is selected, it is copied to the target grid as usual, but remains highlighted. It occurred to me that this might be preventing the removal from the grid when the record is deleted from the store. So in the select handler I deselected the record in the selModel. After that removing the record from the store also removed it from the grid. Bug?

Gary Schlosberg
7 Mar 2017, 10:21 AM
It's not one I've seen reported, but it could be. Support for Ext JS 4 ended on December 31st, 2016, so I'm not able to file a bug report.