andre_mendesc
17 Oct 2012, 7:13 AM
Good morning people,
I have two grids side by side, when I double click on a item in the first one, the selected item is added to the second grid.
The rule is: no duplicates. If i double-click on a item that's already on the second grid, it shall not be added to the second one.
This is the solution I found:
(The listener of the second grid)
listeners:{
itemdblclick: function(dv,record,item,index,e){
if(gridStore.find("name",this.getSelectionModel().getSelection()) == -1)
{
gridStore.add( this.getSelectionModel().getSelection() );
}
}
This doesn't work properly, the item still added, the strange behavior is that when I click on the item name on the top of the grid (the feature to sort the items) the duplicates magically disappear! and if I don't do it and instead try to do something with the duplicates, Ext tell's me "Uncaught TypeError: Cannot read property 'internalId' of undefined"
Crazy, hum? Is it there or not?
I even tried
gridStore.sort('name'); but this doesn't get rid of the duplicates as I expected, they only disappear when I manually tells ext to sort them by clicking on the top of the grid.
What I want is: when I double click something of the first grid that's already on the second grid, I don't want it to be added again.
Can someone help me with this?
Thanks!
I have two grids side by side, when I double click on a item in the first one, the selected item is added to the second grid.
The rule is: no duplicates. If i double-click on a item that's already on the second grid, it shall not be added to the second one.
This is the solution I found:
(The listener of the second grid)
listeners:{
itemdblclick: function(dv,record,item,index,e){
if(gridStore.find("name",this.getSelectionModel().getSelection()) == -1)
{
gridStore.add( this.getSelectionModel().getSelection() );
}
}
This doesn't work properly, the item still added, the strange behavior is that when I click on the item name on the top of the grid (the feature to sort the items) the duplicates magically disappear! and if I don't do it and instead try to do something with the duplicates, Ext tell's me "Uncaught TypeError: Cannot read property 'internalId' of undefined"
Crazy, hum? Is it there or not?
I even tried
gridStore.sort('name'); but this doesn't get rid of the duplicates as I expected, they only disappear when I manually tells ext to sort them by clicking on the top of the grid.
What I want is: when I double click something of the first grid that's already on the second grid, I don't want it to be added again.
Can someone help me with this?
Thanks!