0

I am building a TreeGrid with data from an XML type DataSource, as in SmartClient showcase.

I am using Windows XP and SmartGWT version 3.0, GWT SDK 2.4.0 (using Eclipse IDE).

However, the problem is when I try to expand an empty folder, the tree closes itself/resets and resetting all selections made to none (since i'm using a checkbox tree selection type), and also I got this error(warning):

[ERROR] [testtree] - 15:19:26.637:XRP0:WARN:ResultTree:isc_ResultTree_0 (created by: isc_TreeGrid_0):Adding node to tree with id property set to:1. A node with this ID is already present in this Tree - that node will be replaced. Note that this warning may be disabled by setting the reportCollisions attribute to false.

This is actually very much alike with this (http://forums.smartclient.com/showthread.php?t=20167), however he does not explain the solution. :(

This is the test values i use for the XML data source:

...
<record>
<id>1</id>
<parentId>0</parentId>
<name>test1</name>
</record>

<record>
<id>2</id>
<parentId>1</parentId>
<name>test41</name>
</record>

<record>
<id>3</id>
<parentId>2</parentId>
<name>test2</name>
</record>

<record>
    <id>4</id>
    <parentId>3</parentId>
    <name>test212</name>
</record>

This is the screenshot of the problem; (sorry not enough rep cannot post images) before I clicked the expand button: link (imgur image) and, after: link

According to the image above, this problem will occur if I try to expand 'test212', or 'test2'.

and this is the snippet of my TreeGrid properties:

...
TreeGrid test = new TreeGrid();
test.setAutoFetchData(true);
test.setDataSource(SingletonDS.getInstance());
test.setSelectionAppearance(SelectionAppearance.CHECKBOX);
test.setShowPartialSelection(true);
test.setShowSelectedStyle(false);

layout.addMember(test);

and this is the properties of my singleton DataSource:

...    
singleton.setDataFormat(DSDataFormat.XML);

singleton.setID("singletonDS");

DataSourceIntegerField idField = new DataSourceIntegerField("id", "ID");
idField.setPrimaryKey(true);
DataSourceIntegerField parentIdField = new DataSourceIntegerField("parentId", "Parent ID");
parentIdField.setForeignKey(singleton.getID()+".id");
parentId.setRootValue(0);
DataSourceTextField nameField = new DataSourceTextField("name", "Name");

singleton.setFields(idField, parentIdField, nameField);
...

Note: the XML data is already passed correctly into the grid.

Thanks for your help! :)

RAS
  • 8,100
  • 16
  • 64
  • 86
dvdchr
  • 734
  • 11
  • 26
  • What version of SmartGWT are you using ? Did you tried using the last nightly builds ? Sometimes, this kind of error comes from a framework bug. Let us know. – Jean-Michel Garcia May 19 '12 at 21:08
  • Hi, sorry for the late reply! I am using Windows XP and SmartGWT version 3.0, GWT SDK 2.4.0 (using Eclipse IDE). Will update it on the main post. No, I haven't tried out the nightly builds. :) Thanks for your help! – dvdchr May 20 '12 at 14:57
  • What happens if you use others IDs ? Start at 10 in your above code. This could be related to some "automaticaly" created node (the root one) ? – Jean-Michel Garcia May 21 '12 at 08:53
  • Yes, I have tried using various numbers -- even negatives. What abt you? Does this happen to you too? I will try the nightly build later, and will search more on smartclient forums. One thing that bothers me though, in the thread link I posted above, he seemed to work it out somehow.. So I'm still thinking maybe I'm doing something wrong :? – dvdchr May 21 '12 at 15:19
  • Is the DataSource firing fetch events when you expand tree nodes? – ModeEngage Jun 01 '12 at 00:36
  • Sorry for the late reply! I think i have finally found the solution. This is no bug, it is my own clumsy fault. After debugging the project extensively I noticed that there is a 'idParent' parameter in the GET parameters, and I didn't handle it. As a result, the servlet always outputs full XML data therefore producing this error. – dvdchr Jun 14 '12 at 20:04

1 Answers1

1

I think i have finally found the solution. This is no bug, it is my own clumsy fault.

After debugging the project extensively I noticed that there is a idParent parameter in the GET parameters, and I didn't handle it. As a result, the servlet always outputs full XML data therefore producing this error.

dvdchr
  • 734
  • 11
  • 26