Note that there are some explanatory texts on larger screens.

plurals
  1. POSmartGWT: TreeGrid expand empty folder resets the tree
    text
    copied!<p>I am building a TreeGrid with data from an XML type DataSource, as in SmartClient showcase.</p> <p>I am using Windows XP and SmartGWT version 3.0, GWT SDK 2.4.0 (using Eclipse IDE).</p> <p>However, the problem is when I try to expand an empty folder, the <strong>tree closes itself/resets</strong> and <strong>resetting all selections made to none</strong> (since i'm using a checkbox tree selection type), and also I got this error(warning):</p> <pre><code>[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. </code></pre> <p>This is actually very much alike with this (<a href="http://forums.smartclient.com/showthread.php?t=20167" rel="nofollow">http://forums.smartclient.com/showthread.php?t=20167</a>), however he does not explain the solution. :(</p> <p>This is the test values i use for the XML data source:</p> <pre><code>... &lt;record&gt; &lt;id&gt;1&lt;/id&gt; &lt;parentId&gt;0&lt;/parentId&gt; &lt;name&gt;test1&lt;/name&gt; &lt;/record&gt; &lt;record&gt; &lt;id&gt;2&lt;/id&gt; &lt;parentId&gt;1&lt;/parentId&gt; &lt;name&gt;test41&lt;/name&gt; &lt;/record&gt; &lt;record&gt; &lt;id&gt;3&lt;/id&gt; &lt;parentId&gt;2&lt;/parentId&gt; &lt;name&gt;test2&lt;/name&gt; &lt;/record&gt; &lt;record&gt; &lt;id&gt;4&lt;/id&gt; &lt;parentId&gt;3&lt;/parentId&gt; &lt;name&gt;test212&lt;/name&gt; &lt;/record&gt; </code></pre> <p>This is the screenshot of the problem; (sorry not enough rep cannot post images) <strong>before</strong> I clicked the expand button: <a href="http://imgur.com/Gtzh6" rel="nofollow">link (imgur image)</a> and, <strong>after</strong>: <a href="http://imgur.com/zr1Nk" rel="nofollow">link</a></p> <p>According to the image above, this problem will occur if I try to expand <code>'test212'</code>, or <code>'test2'</code>.</p> <p>and this is the snippet of my TreeGrid properties:</p> <pre><code>... TreeGrid test = new TreeGrid(); test.setAutoFetchData(true); test.setDataSource(SingletonDS.getInstance()); test.setSelectionAppearance(SelectionAppearance.CHECKBOX); test.setShowPartialSelection(true); test.setShowSelectedStyle(false); layout.addMember(test); </code></pre> <p>and this is the properties of my singleton DataSource:</p> <pre><code>... 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); ... </code></pre> <p>Note: the XML data is already passed correctly into the grid.</p> <p>Thanks for your help! :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload