I want to programmatically open entries in my TreeGrid.
I have tried the following:
- setSelectedPaths(). No matter what string I pass in, it says "Unable to parse", even when that string was copy-and-pasted from an earlier call to getSelectedPaths().
- setSelectedState(). That works if the record is already open, otherwise it does nothing.
- setOpenedPaths(). That fails the same way that setSelectedPaths() fails.
I have tried these three things with load-on-demand, and with loading all data at once. I did the latter by changing the DataSource so it returns all data at once. I have tried these things in a DataArrivedHandler, and in the execute() method of the DSCallback that I passed to TreeGrid.fetchData(). I have tried 2.4 and the latest nightly. All of this runs on FireFox in GWT's devmode.
I kind of don't know what else to do. Any help? Thanks!
EDIT: I thought it might help to post my data source:
EDIT: More info:
This is how the tree is set up:
I have tried the following:
- setSelectedPaths(). No matter what string I pass in, it says "Unable to parse", even when that string was copy-and-pasted from an earlier call to getSelectedPaths().
- setSelectedState(). That works if the record is already open, otherwise it does nothing.
- setOpenedPaths(). That fails the same way that setSelectedPaths() fails.
I have tried these three things with load-on-demand, and with loading all data at once. I did the latter by changing the DataSource so it returns all data at once. I have tried these things in a DataArrivedHandler, and in the execute() method of the DSCallback that I passed to TreeGrid.fetchData(). I have tried 2.4 and the latest nightly. All of this runs on FireFox in GWT's devmode.
I kind of don't know what else to do. Any help? Thanks!
EDIT: I thought it might help to post my data source:
Code:
<DataSource ID="browseNodes" serverConstructor="com.mycompany.server.BrowseNodesDataSource"> <fields> <field name="id" type="integer" primaryKey="true" hidden="true" required="true"/> <field name="parentId" type="integer" foreignKey="browseNodes.id" hidden="true" required="true" rootValue="0"/> <field name="name" type="text" required="true"/> </fields> </DataSource>
This is how the tree is set up:
Code:
m_tree = new TreeGrid(); // m_tree.setAutoFetchData(true); m_tree.setDataSource(DataSource.get("browseNodes")); m_tree.addNodeClickHandler(new NodeClickHandler() { public void onNodeClick(final NodeClickEvent event) { final String selectedState = m_tree.getOpenState(); // This is where I copied and pasted from. } }); m_tree.addDataArrivedHandler(new DataArrivedHandler() { public void onDataArrived(final DataArrivedEvent event) { m_tree.setOpenState("[\\r \"/-330\", \\r \"/\"\\r]"); // in other words: ["/-300", "/"] } }); m_tree.fetchData();
Comment