I have a ListGrid similar to some of the examples on the showcase, and while I can reorder records (via drag-and-drop) set by a setData(..) method, I can't reorder records created from an XML data source. Am I setting it up wrong? I have a simple test case below which demonstrates this behavior.
Thanks!
Test.java
TestDataRecord.java
fetch.xml
Thanks!
Test.java
Code:
package test; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.layout.VLayout; public class Test implements EntryPoint { public void onModuleLoad() { VLayout layout = new VLayout(15); final ListGrid grid = new ListGrid(); grid.setWidth(500); grid.setHeight(224); grid.setAlternateRecordStyles(true); grid.setAutoFetchData(true); grid.setCanReorderRecords(true); grid.setDataSource(TestDataRecord.getDataSource()); layout.addMember(grid); layout.draw(); } }
Code:
package test; import com.google.gwt.core.client.GWT; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.data.DataSourceField; import com.smartgwt.client.data.RestDataSource; import com.smartgwt.client.types.DSDataFormat; import com.smartgwt.client.types.FieldType; import com.smartgwt.client.widgets.grid.ListGridRecord; public class TestDataRecord extends ListGridRecord { public static DataSource getDataSource() { DataSourceField name = new DataSourceField("name", FieldType.TEXT, "Name"); name.setValueXPath("@name"); name.setRequired(true); RestDataSource datasource = new RestDataSource(); datasource.setDataURL(GWT.getModuleBaseURL() + "fetch.xml"); datasource.setDataFormat(DSDataFormat.XML); datasource.setXmlRecordXPath("/response/data/category"); datasource.setFields(name); return datasource; } }
Code:
<response> <status>0</status> <data> <category name="Cat1"/> <category name="Cat2"/> <category name="Cat3"/> </data> </response>
Comment