"Bookmark no longer valid" when moving items in AdvancedDataGrid

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

"Bookmark no longer valid" when moving items in AdvancedDataGrid

mraccola
I am trying to implement code to move items up and down in an
AdvancedDataGrid.  When I repeat the "move up" or "move down" action
multiple times in a row I get the error below.  I don't get it every
time but it will come here and there...pretty frequently.  Sometimes I
can click 2, 3, even 4 times without getting an error then I click again
and there it is.
See below for the 3 functions which implement the "move up" feature.
I have tried commenting out the last line in the changeNodeHierarchy
function which re-selects the moved item.  This does seem to resolve the
error but I can't be sure because the occurrence of the error is not
consistent.
Can someone tell me what I am doing wrong?
Code
public function changeNodeHierarchy(dataGrid:AdvancedDataGrid):void{  
var oldSelection:Array = dataGrid.selectedItems.slice();
var selection:Array = DataGridUtil.getSortedSelectedItems(dataGrid);
     for each (var node:Object in selection)    {      
moveUpNode(dataGrid, node);    }
     dataGrid.selectedItems = oldSelection;}
public static function moveUpNode(dataGrid:AdvancedDataGrid,
node:Object):void{    var view:IHierarchicalCollectionView =
dataGrid.hierarchicalCollectionView;    var children:IList =
DataGridUtil.getChildren(dataGrid, view.getParentItem(node));    var
indexInParent:int = children.getItemIndex(node);    if (indexInParent !=
0)        moveNode(dataGrid, node, view.getParentItem(node),
indexInParent - 1);}
private static function moveNode(dataGrid:AdvancedDataGrid, node:Object,
newParent:Object, index:int):void{    var
view:IHierarchicalCollectionView = dataGrid.hierarchicalCollectionView;
if (view.sort == null)    {        var parent:Object =
view.getParentItem(node);        view.removeChild(parent, node);      
view.addChildAt(newParent, node, index);    }}
ErrorError: Bookmark no longer valid. at
ListCollectionViewCursor/seek()[E:\dev\4.x\frameworks\projects\framework\
\src\mx\collections\ListCollectionView.as:2410] at
mx.collections::HierarchicalCollectionViewCursor/get
current()[E:\dev\4.x\frameworks\projects\datavisualization\src\mx\collec\
tions\HierarchicalCollectionViewCursor.as:220] at
mx.collections::HierarchicalCollectionViewCursor/collectionChangeHandler\
()[E:\dev\4.x\frameworks\projects\datavisualization\src\mx\collections\H\
ierarchicalCollectionViewCursor.as:1143] at
flash.events::EventDispatcher/dispatchEventFunction() at
flash.events::EventDispatcher/dispatchEvent() at
mx.collections::HierarchicalCollectionView/nestedCollectionChangeHandler\
()[E:\dev\4.x\frameworks\projects\datavisualization\src\mx\collections\H\
ierarchicalCollectionView.as:1589] at
flash.events::EventDispatcher/dispatchEventFunction() at
flash.events::EventDispatcher/dispatchEvent() at
mx.collections::ListCollectionView/dispatchEvent()[E:\dev\4.x\frameworks\
\projects\framework\src\mx\collections\ListCollectionView.as:1024] at
mx.collections::ListCollectionView/removeItemsFromView()[E:\dev\4.x\fram\
eworks\projects\framework\src\mx\collections\ListCollectionView.as:1681]
at
mx.collections::ListCollectionView/listChangeHandler()[E:\dev\4.x\framew\
orks\projects\framework\src\mx\collections\ListCollectionView.as:1292]
at flash.events::EventDispatcher/dispatchEventFunction() at
flash.events::EventDispatcher/dispatchEvent() at
mx.collections::XMLListAdapter/removeItemAt()[E:\dev\4.x\frameworks\proj\
ects\framework\src\mx\collections\XMLListAdapter.as:431] at
mx.collections::ListCollectionView/removeItemAt()[E:\dev\4.x\frameworks\\
projects\framework\src\mx\collections\ListCollectionView.as:762] at
ListCollectionViewCursor/remove()[E:\dev\4.x\frameworks\projects\framewo\
rk\src\mx\collections\ListCollectionView.as:2330] at
mx.collections::HierarchicalCollectionView/removeChild()[E:\dev\4.x\fram\
eworks\projects\datavisualization\src\mx\collections\HierarchicalCollect\
ionView.as:731]
Reply | Threaded
Open this post in threaded view
|

Re: "Bookmark no longer valid" when moving items in AdvancedDataGrid

mraccola
Does anyone have any ideas on how I can resolve or troubleshoot further?

Reply | Threaded
Open this post in threaded view
|

Re: Re: "Bookmark no longer valid" when moving items in AdvancedDataGrid

gemoussier
Hi,

I had a bookmark error once. I was removing item in a ArrawyCollection
during a for each loop, something like that :

for each(var myEntry:Entry in _entries)
{
...
_entries.removeItemAt(_entries.getItemIndex(myEntry));
...
}

Maybe you have something similar somewhere.


Matthew a écrit :
>
> Does anyone have any ideas on how I can resolve or troubleshoot further?
>
>



------------------------------------

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    [hidden email]
    [hidden email]

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply | Threaded
Open this post in threaded view
|

Re: "Bookmark no longer valid" when moving items in AdvancedDataGrid

Amy-28
In reply to this post by mraccola
Don't move the visual representation of the dat.  Instead, move the data, and let the ADG move the visual representation.

HTH;

Amy

--- In [hidden email], "Matthew" <mraccola@...> wrote:

>
> I am trying to implement code to move items up and down in an
> AdvancedDataGrid.  When I repeat the "move up" or "move down" action
> multiple times in a row I get the error below.  I don't get it every
> time but it will come here and there...pretty frequently.  Sometimes I
> can click 2, 3, even 4 times without getting an error then I click again
> and there it is.
> See below for the 3 functions which implement the "move up" feature.
> I have tried commenting out the last line in the changeNodeHierarchy
> function which re-selects the moved item.  This does seem to resolve the
> error but I can't be sure because the occurrence of the error is not
> consistent.
> Can someone tell me what I am doing wrong?
> Code
> public function changeNodeHierarchy(dataGrid:AdvancedDataGrid):void{  
> var oldSelection:Array = dataGrid.selectedItems.slice();
> var selection:Array = DataGridUtil.getSortedSelectedItems(dataGrid);
>      for each (var node:Object in selection)    {      
> moveUpNode(dataGrid, node);    }
>      dataGrid.selectedItems = oldSelection;}
> public static function moveUpNode(dataGrid:AdvancedDataGrid,
> node:Object):void{    var view:IHierarchicalCollectionView =
> dataGrid.hierarchicalCollectionView;    var children:IList =
> DataGridUtil.getChildren(dataGrid, view.getParentItem(node));    var
> indexInParent:int = children.getItemIndex(node);    if (indexInParent !=
> 0)        moveNode(dataGrid, node, view.getParentItem(node),
> indexInParent - 1);}
> private static function moveNode(dataGrid:AdvancedDataGrid, node:Object,
> newParent:Object, index:int):void{    var
> view:IHierarchicalCollectionView = dataGrid.hierarchicalCollectionView;
> if (view.sort == null)    {        var parent:Object =
> view.getParentItem(node);        view.removeChild(parent, node);      
> view.addChildAt(newParent, node, index);    }}
> ErrorError: Bookmark no longer valid. at
> ListCollectionViewCursor/seek()[E:\dev\4.x\frameworks\projects\framework\
> \src\mx\collections\ListCollectionView.as:2410] at
> mx.collections::HierarchicalCollectionViewCursor/get
> current()[E:\dev\4.x\frameworks\projects\datavisualization\src\mx\collec\
> tions\HierarchicalCollectionViewCursor.as:220] at
> mx.collections::HierarchicalCollectionViewCursor/collectionChangeHandler\
> ()[E:\dev\4.x\frameworks\projects\datavisualization\src\mx\collections\H\
> ierarchicalCollectionViewCursor.as:1143] at
> flash.events::EventDispatcher/dispatchEventFunction() at
> flash.events::EventDispatcher/dispatchEvent() at
> mx.collections::HierarchicalCollectionView/nestedCollectionChangeHandler\
> ()[E:\dev\4.x\frameworks\projects\datavisualization\src\mx\collections\H\
> ierarchicalCollectionView.as:1589] at
> flash.events::EventDispatcher/dispatchEventFunction() at
> flash.events::EventDispatcher/dispatchEvent() at
> mx.collections::ListCollectionView/dispatchEvent()[E:\dev\4.x\frameworks\
> \projects\framework\src\mx\collections\ListCollectionView.as:1024] at
> mx.collections::ListCollectionView/removeItemsFromView()[E:\dev\4.x\fram\
> eworks\projects\framework\src\mx\collections\ListCollectionView.as:1681]
> at
> mx.collections::ListCollectionView/listChangeHandler()[E:\dev\4.x\framew\
> orks\projects\framework\src\mx\collections\ListCollectionView.as:1292]
> at flash.events::EventDispatcher/dispatchEventFunction() at
> flash.events::EventDispatcher/dispatchEvent() at
> mx.collections::XMLListAdapter/removeItemAt()[E:\dev\4.x\frameworks\proj\
> ects\framework\src\mx\collections\XMLListAdapter.as:431] at
> mx.collections::ListCollectionView/removeItemAt()[E:\dev\4.x\frameworks\\
> projects\framework\src\mx\collections\ListCollectionView.as:762] at
> ListCollectionViewCursor/remove()[E:\dev\4.x\frameworks\projects\framewo\
> rk\src\mx\collections\ListCollectionView.as:2330] at
> mx.collections::HierarchicalCollectionView/removeChild()[E:\dev\4.x\fram\
> eworks\projects\datavisualization\src\mx\collections\HierarchicalCollect\
> ionView.as:731]
>


Reply | Threaded
Open this post in threaded view
|

Re: "Bookmark no longer valid" when moving items in AdvancedDataGrid

FlexCoders mailing list
This bug has now been resolved in the SDK - see this link and all its linked tickets [FLEX-34119] mx.collections.HierarchicalCollectionViewCursor causes CursorError RTE from ListCollectionView when the underlying collections change https://issues.apache.org/jira/browse/FLEX-34119 
 
 [FLEX-34119] mx.collections.HierarchicalCollectionViewCursor... https://issues.apache.org/jira/browse/FLEX-34119 Steps to reproduce A: Run the HierarchicalCollectionViewCursor_FLEX_34119_Test unit test. You should see lots of "Bookmark no longer valid" errors. Steps to reproduce B: Run the attached AIR project.
 
 
 
 View on issues.apache.org https://issues.apache.org/jira/browse/FLEX-34119 
 Preview by Yahoo
 
 
 
 It will be available in the next version of the SDK (probably 4.14), but until then you can use a nightly build to benefit from the fix.