When exporting a listgrid with a field which has a displayfield set, the valuefield is exported instead of the displayfield.
Tested this with SC_SNAPSHOT-2011-05-23/EVAL Deployment (expires 2011.07.22_09.36.51) on GWT 2.1.0 with Firefox 4
DataSource:
Tested this with SC_SNAPSHOT-2011-05-23/EVAL Deployment (expires 2011.07.22_09.36.51) on GWT 2.1.0 with Firefox 4
Code:
package test.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.widgets.Button; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.layout.VLayout; public class ExportTest implements EntryPoint { public void onModuleLoad() { final ListGrid listGrid = new ListGrid(); ListGridField locationField = new ListGridField("cntn_fk_location", "Location"); locationField.setDisplayField("lctn_name"); listGrid.setFields(locationField); listGrid.setDataSource(DataSource.get("contents")); listGrid.setWidth100(); listGrid.setHeight100(); listGrid.fetchData(); Button button = new Button(); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { listGrid.exportClientData(); } }); VLayout vLayout = new VLayout(); vLayout.addMember(listGrid); vLayout.addMember(button); vLayout.setWidth100(); vLayout.setHeight100(); vLayout.draw(); } }
Code:
<DataSource ID="contents" serverType="sql" tableName="content"> <fields> <field primaryKey="true" type="sequence" name="cntn_pk" hidden="true" export="false"></field> <field title="Location" type="integer" name="cntn_fk_location"></field> <field title="Location_display" type="text" name="lctn_name" hidden="true" customSQL="true"></field> </fields> <operationBindings> <operationBinding operationType="fetch"> <selectClause>$defaultSelectClause, (SELECT lctn_name FROM location t WHERE t.lctn_pk = cntn_fk_location) AS lctn_name</selectClause> </operationBinding> </operationBindings> </DataSource>