Hi - I am trying to display a nested ListGrid. I followed the example in the showcase but I must be missing something.
The main ListGrid loads from Datasource1 and the nested one loads from Datasource2. Both datasources have one field in common.
Problem: My nested Datasource2 displays only the first line of data, and displays the same line of nested data everywhere (under all high-level elements). Please see attached image for the display that I get. That display is what I want, except for the missing lines of data and the fact that the link between the DS and nested DS is apparently not working in my code.
Using Smartgwt 4.1p.
Widget creation
Datasource1 (main)
Datasource2 (nested)
Datasource1 XML
Datasource2 XML
If anyone has any pointers as to what I am doing wrong, that would be great.
The main ListGrid loads from Datasource1 and the nested one loads from Datasource2. Both datasources have one field in common.
Problem: My nested Datasource2 displays only the first line of data, and displays the same line of nested data everywhere (under all high-level elements). Please see attached image for the display that I get. That display is what I want, except for the missing lines of data and the fact that the link between the DS and nested DS is apparently not working in my code.
Using Smartgwt 4.1p.
Widget creation
Code:
package gov.nist.toolkit.xdstools3.client.customWidgets.endpoints.configure; import com.smartgwt.client.types.ExpansionMode; import com.smartgwt.client.types.ListGridEditEvent; import com.smartgwt.client.types.RowEndEditAction; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.layout.HLayout; /** * * Created by dazais on 5/21/2014. */ public class EndpointsConfigWidget extends HLayout { private ListGrid endpointGrid; private boolean endpointValueSelected = false; public EndpointsConfigWidget() { endpointGrid = createEndpointGrid(); addMember(endpointGrid); } public ListGrid createEndpointGrid() { final ListGrid grid = new ListGrid(); grid.setHeight(500); grid.setWidth(800); grid.setAlternateRecordStyles(true); grid.setDataSource(EndpointConfigDSNew.getInstance()); grid.setAutoFetchData(true); grid.setDrawAheadRatio(4); grid.setCanExpandRecords(true); grid.setCanExpandMultipleRecords(true); grid.setExpansionMode(ExpansionMode.RELATED); grid.setDetailDS(TransactionDS.getInstance()); // other TransactionDS grid.setCanEdit(true); grid.setModalEditing(true); grid.setEditEvent(ListGridEditEvent.CLICK); grid.setListEndEditAction(RowEndEditAction.NEXT); grid.setAutoSaveEdits(false); return grid; } }
Code:
package gov.nist.toolkit.xdstools3.client.customWidgets.endpoints.configure; import com.smartgwt.client.data.RestDataSource; import com.smartgwt.client.data.fields.DataSourceTextField; /** * SmartGWT datasource for accessing entities over http in a RESTful manner. * Defines a RESTDataSource fields, operations and REST service URLs. */ public class EndpointConfigDSNew extends RestDataSource { private static EndpointConfigDSNew instance = null; public static EndpointConfigDSNew getInstance() { if (instance == null) { instance = new EndpointConfigDSNew(); } return instance; } private EndpointConfigDSNew() { setID("endpointConfigDS"); setDataURL("resources/datasources/endpoints/_actors.data.xml"); setRecordXPath("/sites/site"); // this is the path to the record we want to display, inside the XML file holding the data DataSourceTextField endpointName = new DataSourceTextField("endpointName", "Endpoint Name"); setFields(endpointName); } }
Code:
package gov.nist.toolkit.xdstools3.client.customWidgets.endpoints.configure; import com.smartgwt.client.data.RestDataSource; import com.smartgwt.client.data.fields.DataSourceTextField; public class TransactionDS extends RestDataSource { private static TransactionDS instance = null; public static TransactionDS getInstance() { if (instance == null) { instance = new TransactionDS(); } return instance; } private TransactionDS() { setID("transactionDS"); setDataURL("resources/datasources/endpoints/pub-edited.data.xml"); setRecordXPath("/site"); //the XML path of the element we want to display, in the datasource file (.data.xml) DataSourceTextField endpointName = new DataSourceTextField("name", "Endpoint Name"); //System.out.println(endpointName.getValueXPath()); //endpointName.setHidden(true); endpointName.setCanEdit(false); endpointName.setForeignKey("endpointConfigDS.endpointName"); DataSourceTextField code = new DataSourceTextField("transaction.code"); code.setPrimaryKey(true); code.setHidden(true); DataSourceTextField name = new DataSourceTextField("transaction.name", "Transaction Type", 128, true); // isRequired = true DataSourceTextField tls = new DataSourceTextField("transaction.secure", "TLS Endpoint"); DataSourceTextField notls = new DataSourceTextField("transaction.unsecure", "Non-TLS Endpoint"); setFields(code, name, tls, notls, endpointName); } }
Datasource1 XML
Code:
<sites> <site> <endpointName>pub</endpointName> <parentID>root</parentID> </site> <site> <endpointName>connect3.3_AMAZON</endpointName> <parentID>root</parentID> </site> </sites>
Datasource2 XML
Code:
<site name="pub"> <home>urn:oid:1.19.6.24.109.42.1.3</home> <transaction code="sq.b" name="Stored Query"> <secure>https://ihexds.nist.gov:12081/tf6/services/xdsregistryb</secure> <unsecure>http://ihexds.nist.gov:12080/tf6/services/xdsregistryb</unsecure> </transaction> <transaction code="r.b" name="Register"> <secure>https://ihexds.nist.gov:12081/tf6/services/xdsregistryb</secure> <unsecure>http://ihexds.nist.gov:12080/tf6/services/xdsregistryb</unsecure> </transaction> <repository uid="1.19.6.24.109.42.1.5"> <secure>https://ihexds.nist.gov:12081/tf6/services/xdsrepositoryb</secure> <unsecure>http://ihexds.nist.gov:12080/tf6/services/xdsrepositoryb</unsecure> </repository> </site>
Comment