PDA

View Full Version : [2.0.1] TreePanel can't set html id on nodes



The_Jackal
29 Jul 2009, 5:46 PM
I've just migrated from Tree to TreePanel. I was setting id's on TreeItems so that the HTML had real id attributes instead of the GXT generated ids. This is resquired for reliable selenium testing etc.

It appears that you can no longer set the id attributes on node in a TreePanel.

If you somehow can, please let us know and move this to the help section. If not then I suggest that you allow the id property of a BaseTreeModel to be set as the html id attribute.

Perhaps a methods like:
setIdAttributeFromProperty(String propertyname) or setIdAtrribute(String id)

Regards,
Carl

sven
30 Jul 2009, 12:06 AM
Why this is a bug? Moving this to the help forum. This is not a bug. You can extend TreePanelView and override getTemplate to setup an template on your node.

The_Jackal
30 Jul 2009, 3:30 PM
It's a bug because the old deprecated Tree supported id's on nodes and the new replacement does not. Breaking or reducing functionality seems buggy to me.

Perhaps this is a feature request then? I think you should be able to set manual id's on all components - auto generated id's are a hindrance to automated testing.

I tried overriding the register method to still do it's work but also return a property from the model to be used as the id. Even though it looks like the view template is the only thing that uses that id, the TreePanel throws javascript errors (no first child).

sven
30 Jul 2009, 11:34 PM
Yes you can set ids on the components. However the nodes are no components.

The_Jackal
31 Jul 2009, 3:54 AM
True, but with Tree the TreeItems were components, so I believe that TreePanel should support a similar mechanism, but allowing the overwriting of the generate id on the nodes

sven
31 Jul 2009, 4:03 AM
Ok, here we go.
Define a modelkeyprovider on the store. The returned key will be set as id. Take a look at the AsyncTreeExample. I will reply as soon as this hit svn.

The_Jackal
31 Jul 2009, 2:17 PM
Thanks Sven! The Selenium testers out there will appreciate it!

sven
3 Aug 2009, 7:07 AM
Change is in SVN now.

sven
4 Aug 2009, 5:48 AM
Have you already checked out the change. Is it working for you?

The_Jackal
4 Aug 2009, 4:09 PM
I haven't hand the chance yet, but shortly I'm going to convert all the other tree panels will test this out.

Do you remember what revision the features where checked in so I can compare the diffs?

C