Hi Isomorphic,
in this case, "ListGrid.exportClientData" is not working properly.
The values for the "Manager" field are incorrect.
SmartClient Version: v12.0p_2019-12-14/PowerEdition Deployment (built 2019-12-14)
BuiltInDS.java
employees.ds.xml
Best regards
Pavo
in this case, "ListGrid.exportClientData" is not working properly.
The values for the "Manager" field are incorrect.
SmartClient Version: v12.0p_2019-12-14/PowerEdition Deployment (built 2019-12-14)
BuiltInDS.java
Code:
package com.smartgwt.sample.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.Version; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.DSRequest; import com.smartgwt.client.data.SortSpecifier; import com.smartgwt.client.rpc.RPCCallback; import com.smartgwt.client.rpc.RPCRequest; import com.smartgwt.client.rpc.RPCResponse; import com.smartgwt.client.types.ExportFormat; import com.smartgwt.client.types.SortDirection; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.PageKeyHandler; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Button; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.Window; 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 BuiltInDS extends VLayout implements EntryPoint { private IButton recreateBtn; public void onModuleLoad() { KeyIdentifier debugKey = new KeyIdentifier(); debugKey.setCtrlKey(true); debugKey.setKeyName("D"); Page.registerKey(debugKey, new PageKeyHandler() { public void execute(String keyName) { SC.showConsole(); } }); setWidth100(); setHeight100(); recreateBtn = new IButton("Recreate"); recreateBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { new MyWindow().show(); } }); addMember(recreateBtn); new MyWindow().show(); draw(); } private class MyWindow extends Window { public MyWindow() { setWidth(400); setHeight(300); setMembersMargin(0); setModalMaskOpacity(70); setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")"); setTitle("img- vs object-tag issue" + getTitle()); setShowMinimizeButton(false); setIsModal(true); setShowModalMask(true); centerInPage(); ListGrid lg = new ListGrid(); lg.setDataSource("employees"); ListGridField userOrderLGF = new ListGridField("userOrder"); ListGridField reportsToLGF = new ListGridField("ReportsTo"); ListGridField emailLGF = new ListGridField("Email"); lg.setFields(userOrderLGF, reportsToLGF, emailLGF); lg.setSort(new SortSpecifier("Email", SortDirection.ASCENDING)); lg.fetchData(); Button exportButton = new Button("Export data"); exportButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { final DSRequest exportRequest = new DSRequest() { { setExportAs(ExportFormat.OOXML); setExportFilename("Test"); } }; SC.showPrompt("Test", "Test"); lg.exportClientData(exportRequest, new RPCCallback() { @Override public void execute(RPCResponse response, Object rawData, RPCRequest request) { SC.clearPrompt(); } }); } }); addItem(lg); addItem(exportButton); } } }
Code:
<DataSource ID="employees" serverType="sql" tableName="employeeTable" recordName="employee" testFileName="/examples/shared/ds/test_data/employees.data.xml" titleField="Name" > <fields> <field name="userOrder" title="userOrder" type="integer" canEdit="false" hidden="true"/> <field name="Name" title="Name" type="text" length="128"/> <field name="EmployeeId" title="Employee ID" type="integer" primaryKey="true" required="true"/> <field name="ReportsTo" title="Manager" type="integer" required="true" foreignKey="employees.EmployeeId" rootValue="1" displayField="EmployeeId" sortByField="Email"/> <field name="Job" title="Title" type="text" length="128"/> <field name="Email" title="Email" type="text" length="128"/> <field name="EmployeeType" title="Employee Type" type="text" length="40"/> <field name="EmployeeStatus" title="Status" type="text" length="40"/> <field name="Salary" title="Salary" type="float"/> <field name="OrgUnit" title="Org Unit" type="text" length="128"/> <field name="Gender" title="Gender" type="text" length="7"> <valueMap> <value>male</value> <value>female</value> </valueMap> </field> <field name="MaritalStatus" title="Marital Status" type="text" length="10"> <valueMap> <value>married</value> <value>single</value> </valueMap> </field> </fields> </DataSource>
Pavo
Comment