Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Datasource XML Binding

    Hi,

    I'm not only new to SmartGWT, but to GWT also. I'm trying to make a simple application. The source XML is similar to the following:

    Code:
    <List>
    	<process>
    		<process-id>4.1</process-id>
    		<process-name>Develop Project Charter</process-name>
    		<process-group>Initiating</process-group>
    		<input>Project Statement of Work</input>
    		<input>Business Case</input>
    		<input>Contract</input>
    	</process>
    </List>
    As you can see, there are multiple "input" nodes for each "process" node. I want to display the following values in the main ListGrid:

    Process ID | Process Name | Process Group

    When a row is selected in the Grid, I have another ListGrid below the main Grid. This second list has only one column, which will list the "input" values for the selected Process ID.

    I did the mapping like this:

    Code:
    setRecordXPath("/List/process");
    DataSourceTextField processNameField = new DataSourceTextField("process-name", "Process Name", 128);
    DataSourceTextField processIdField = new DataSourceTextField("process-id", "Process ID", 128);
    DataSourceTextField procGrpField = new DataSourceTextField("process-group", "Process Group", 128);
    DataSourceTextField inputField = new DataSourceTextField("input", "Input(s)", 128);
    The code that populates the "input" Grid is:

    Code:
    mainGrid.addSelectionChangedHandler(new SelectionChangedHandler() {  
                public void onSelectionChanged(SelectionEvent event) {  
                	inputGrid.setData(mainGrid.getSelection());  
                }
    The problem is obviously that I'm getting all the "input" values separated by commas in a single text field. I would like to get the values in a List or an Array so that they can be displayed in a separate ListGrid.

    I need some help in getting the multiple input elements from the XML and display them as a list.

    Thanks.
    Last edited by deepfriedbrain; 15 Sep 2010, 08:40.

    #2
    I'm not sure whether my question was not clear or I missed some information, but please let me know if you need any information from me in order to help me on this issue.

    Thanks.

    Comment

    Working...
    X