Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by richard white on Jun 12, 2008 15:52
open dhtmlx forum
drag functon and treegrid error

hi

i have a treegrid which has various levels of folders and items inside the folders

i also have a grid on the same page.

i have the functionality where someone can drag an item from the tree over to the grid. it adds the item in the grid but instead of removing it from the tree, it changes the background colour of that row in the tree

this is working fine except when i try to drag it back again.

when i drag it back i have a drag handler on the tree that removes it from the grid and changes the row colour back to white in the tree when they drag it back into the tree

the problem is this:

when the page first loads, it loads the items into the tree through xml and i use the enableSmartXMLParsing when i load it

then if i try to drag an item from the grid to the tree and use the code: 'subjectTree.setRowColor(idSplitArray[i],"#FFFFFF");' in the drag handler to change the colour of that item in the tree, and i have not yet physically opened the item then i get the following error:

this._openItem is not a function
[Break on this error] this._openItem(this.rowsAr[line[i]]);

is this because i am using the enableSmartXMLParsing - and its because the row has not yet loaded?

if this is the case then how can i get round this? and if not then do you have any ideas what it may be and how i can get around it?

thanks very much
Answer posted by Support on Jun 13, 2008 02:40
Problem confirmed for dhtlmxTreeGrid 1.5 ( The issue already fixed in latest dhtmlxTreeGrid 1.6 )
Situation really caused by calling operation against the not rendered item
Please try to use attached js patch - it must resolve issue in dhtmlxTreeGrid 1.5 ( with it, operations against not rendered nodes must run correctly )
Attachments (1)
Answer posted by richard white on Jun 13, 2008 03:23
ok thanks

you have mentioned a few times that things have been fixed in 1.6, has 1.6 been released yet? we paid for a years license so should we have received this new version?

thanks
Answer posted by richard on Jun 13, 2008 04:29
hi

we also dont use the normal drag and drop functionality, we need to do some processing on the items they drag from the tree to the grid. and then manually code it to add it into the grid and take it out of the tree.

however, if a folder has not been opened and we try to drag it into the grid, we use the getAllSubItems function and when we do our processing it says row not exists when trying to reference the trees rows. is this again because it is not yet loaded through xml. do you have a fix for this as well?

thanks
Answer posted by Support on Jun 13, 2008 07:27
The 1.6 version was released on May 12, if you not received email with update information - please drop a letter to sales@dhtmlx.com - they will provide all necessary info.
Answer posted by Support on Jun 13, 2008 07:31
>>we try to drag it into the grid, we use the getAllSubItems function
In case of smartXMLParsing enabled this method will not return correct info ( the branch is not parsed, so the info about child items not available yet )
In TreeGrid 1.5 you can force branch parsing in SRND mode by
    grid._reParse(grid.rowsAr[ID]);
where ID - id of row in question
After such command getAllSubItems  must return correct result.

By the way, getAllSubItems  in dhtmlxTreeGrid 1.6 will return correct data in same situation.


Answer posted on Jun 24, 2008 05:38
Hi

the fix you gave me above works fine.

however if i try to reference an item in the tree using the getItemImage method and the row i am trying to get an image for is part of a folder that is not yet opened then it produces an error saying:

this._h2.get[rowId] has no properties

is there a way i can get round this as well please

thanks
Answer posted on Jun 24, 2008 06:13
Problem confirmed. We will fix it in next build.
For now you can use next approach

    mygrid.getRowById(ID);
    var image = mygrid.getItemImage(ID);

first command will process row in question, so it will be available for any API calls.
Answer posted on Jun 24, 2008 06:16
ok thanks