Bug? Create a branch in a Tree and other rows go blank and get offset


hi

 

a bit of background on component first. have custom component extends tree. component represents documents  , pages.   tree has 2 levels.  first level the  documents , 2nd level documents pages. conceptually, document also  represents first page, document has more 1 page a  branch leaves/children, while 1 page document leaf.

pressing [enter] key down (or [space] or double clicking mouse) when on a  page make page document.  in background flex may move leaves (i.e. children) of previous  document new document. set selecteditem to  2nd page of new document (i.e. first child leaf of the  document branch).

 

under hood, when creating new document move relevant pages  of previous document pages of new document.  is, a  sub-section of children of previous branch (document) become children  of new branch (new document).  because can potentially have thousands of pages in tree using array functions move children rather arraycollection functions.

 

so current code is:

 

            // copy relevant pages pagesdocument newdocument
            // use array functions rather arraycollection functions improve performance
            if (pagesdocument.children.length > (pageindex+1))
                newdocument.children = new arraycollection(pagesdocument.children.toarray().slice(pageindex+1, pagesdocument.children.length));
           
            // delete newdoc's pages pagesdocument
            // use array functions rather arraycollection functions improve performance
            if (pageindex > 0)
                pagesdocument.children = new arraycollection(pagesdocument.children.toarray().slice(0, pageindex));
            else
                pagesdocument.children = null;

 

i can confirm issue not happen if use arraycollection functions, ala:

 

            // store length of pagesdocument's pages in variable, because real length decrease 1 each time remove child document.
            // in addition keep in mind after removing child subsequent child take place, retrieve , remove nodes @ same index: pageindex.
            var pagecount:int = pagesdocument.children.length;
            // initialise vars since doing in loop can affect performance
            var pagenode:object;
            (var i:int = pageindex; < pagecount; i++)
            {
                // create children prop if doesn't exist
                if (i == (pageindex+1))
                    newdocument.children = new arraycollection();
               
                // copy page var
                pagenode = pagesdocument.children.getitemat(pageindex);
               
                // remove page document's pages
                pagesdocument.children.removeitemat(pageindex);
               
                // add page end of new document. don't add first page since becoming document.
                if (i != pageindex)
                    newdocument.children.additem( pagenode );
            }

 

it takes several seconds create document using arraycollection functions when there 1000 rows in tree whilst array functions in less second.  using arraycollection functions not option due poor performance when there decent amount of rows.

 

the following steps reproduce issue in component along screenshots.

 

if create new document (by hitting enter, space or double clicking on page, in instance 0277) , document last 1 in list (that is, issue not occur if create document between 2 existing documents) component creates document , looks fine on screen.

priortocreatingbranch.jpgbranchcreated.jpg

 

however, if scroll up, first row in tree not first row but  row x rows below should first row (759 rows in instance).

scrolltotop.jpg

if scroll down rows go blank or repeat of last row.

scrolltobottom.jpg

the underlying data each row still correct, if first displayed row page 92 data page 92 - know because have click event calls external javascript loads file page represents.  however, if row has been made blank not have associated data , cannot selected.

 

if ctrl+home take me top, display rectifies , first row displayed.

 

the issue still exists if scrolling steps reversed, i.e. scroll down first scroll , rows missing / offset, ctrl+end rectify data.

 

i'm @ loss happening here. have tried running invalidatelist , invalidatedisplaylist after manipulating children of relevant branches not resolve issue.

 

anyone have ideas?

 

i have posted bug few weeks ago on https://bugs.adobe.com/ (sdk-26677) have not gotten response.

 

i have think bug scroll bar disappears when delete document , use array functions, i'll put in separate post later because boss pushing me work on else.

 

thanks

 

nathan

arraycollection dispatches notifications when change made tree

can follow along.  array not.  in theory, if reset dataprovider

(or maybe fake collectionevent collectioneventkind.reset) tree

will reset after make array changes.



More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

CS5 Adobe Media Encoder: Encode failed because the source duration is nil.

cf_sql_integer vs cf_sql_bigint vs cf_sql_int??

localhost/joomla15/administrator doesnt work - Joomla! Forum - community, help and support