Drag Drop with XML DataSource not working in SmartGWT

I am using an example:

http://www.smartclient.com/smartgwt/showcase/#tree_interaction_drag_nodes

but changed datasource to XML file and now it doesn't work.

XML used:

<RootNode>
<ChildNode>
    <ChildID>2</ChildID>
    <Name>ChildNode1</Name>
    <ReportsTo>1</ReportsTo>
</ChildNode>
<ChildNode>
    <ChildID>3</ChildID>
    <Name>ChildNode1.1</Name>
    <ReportsTo>2</ReportsTo>
</ChildNode>
<ChildNode>
    <ChildID>4</ChildID>
    <Name>ChildNode2</Name>
    <ReportsTo>1</ReportsTo>
</ChildNode>
<ChildNode>
    <ChildID>5</ChildID>
    <Name>ChildNode2.1</Name>
    <ReportsTo>4</ReportsTo>
</ChildNode>
<ChildNode>
    <ChildID>6</ChildID>
    <Name>ChildNode2.1.1</Name>
    <ReportsTo>5</ReportsTo>
</ChildNode>
</RootNode>

      

whereas for grid1 and grid2 I change datasources to xml file like this:
Instead of:

grid1.setData(grid1Tree);  
grid1.getData().openAll(); 

      

I use:

    grid1.setAutoFetchData(true);  
    grid1.setDataSource(EmployeeXmlDS.getInstance());    
    grid1.draw();

      

And similarly for grid2. And here is the EmployeeXmlDS implementation:

import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;


public class EmployeeXmlDS extends DataSource {

    private static EmployeeXmlDS instance = null;

    public static EmployeeXmlDS getInstance() {
        if (instance == null) {
            instance = new EmployeeXmlDS("employeesDS");
        }
        return instance;
    }

    public EmployeeXmlDS(String id) {

        setID(id);
        setTitleField("Name");
        setRecordXPath("/RootNode/ChildNode");
        DataSourceTextField nameField = new DataSourceTextField("Name", "Name", 128);
        DataSourceIntegerField childIdField = new DataSourceIntegerField("ChildID", "Child ID");
        childIdField.setPrimaryKey(true);
        childIdField.setRequired(true);
        DataSourceIntegerField reportsToField = new DataSourceIntegerField("ReportsTo", "Parent");
        reportsToField.setRequired(true);
        reportsToField.setForeignKey(id + ".ChildID");
        reportsToField.setRootValue("1");
        setFields(nameField,childIdField,reportsToField);
        setDataURL("ds/test_data/tree2.xml");
        setClientOnly(true);
    }
}

      

Please, help.

+2
java gwt smartgwt


source to share


No one has answered this question yet

See similar questions:

3
How do I retrieve all data from a data source?
2
Disable XML TreeGrid caching

or similar:

7
SMART GWT DataSource (GWT-RPC-DATASource) LISTGRID
five
Datasource SmartGWT Setup Tutorial
2
Listen to DataSource operation and notify listeners in SmartGWT
1
Creating a smart data source for SmartGWT
1
SmartGwt: How to provide XML data to TreeGrid-DataSource?
1
SmartGwt drag and drop on a tree component
0
How do I secure an XML based data source?
0
Browser issue with smartgwt drag & drop
0
SmartGWT: ListGrid Drag and Drop Settings
0
SmartGWT XML Data String



All Articles
Loading...
X
Show
Funny
Dev
Pics