Hi Isomorphic,
please see this BuiltInDS based testcase (v10.0p_2015-10-23).
BuiltInDS.java:
animals.ds.xml:
Doubleclick the ListGrid in order to edit a row and look at the requests sent in the Developer Console.
You'll see a fetchMissingValues-request and a PickList-request, both for the lifeSpan field.
Now reopen readonly via the button:
Doubleclick the ListGrid in order to edit a row and look at the requests sent in the Developer Console.
You'll see a fetchMissingValues-request and no PickList-request.
In my opinion, the fetchMissingValues-request should be gone as well, especially as you don't use the returned value (SKU, where the normal displayField is itemName).
Best regards
Blama
please see this BuiltInDS based testcase (v10.0p_2015-10-23).
BuiltInDS.java:
Code:
package com.smartgwt.sample.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.PageKeyHandler; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.form.fields.SelectItem; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.layout.VLayout; public class BuiltInDS implements EntryPoint { private VLayout mainLayout; private IButton recreateBtn; private IButton recreateBtn2; private ListGrid lg; 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(); } }); mainLayout = new VLayout(20); mainLayout.setWidth100(); mainLayout.setHeight100(); recreateBtn = new IButton("Recreate lifespan RO"); recreateBtn.setWidth(150); recreateBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { recreate(false); } }); mainLayout.addMember(recreateBtn); recreateBtn2 = new IButton("Recreate lifespan RW"); recreateBtn2.setWidth(150); recreateBtn2.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { recreate(true); } }); mainLayout.addMember(recreateBtn2); recreate(true); mainLayout.draw(); } private void recreate(boolean lifespanRW) { if (lg != null) { mainLayout.removeMember(lg); lg.markForDestroy(); } lg = new ListGrid(DataSource.get("animals")); lg.setWidth("90%"); lg.setHeight("80%"); lg.setCanEdit(true); lg.setAutoFetchData(false); ListGridField commonName = new ListGridField("commonName"); ListGridField scientificName = new ListGridField("scientificName"); ListGridField lifeSpan = new ListGridField("lifeSpan"); SelectItem lifeSpanEditor = new SelectItem(); lifeSpanEditor.setOptionDataSource(DataSource.get("supplyItem")); lifeSpanEditor.setDisplayField("SKU"); lifeSpanEditor.setSortField("SKU"); lifeSpan.setEditorProperties(lifeSpanEditor); // Important lifeSpan.setCanEdit(lifespanRW); ListGridField status = new ListGridField("status"); lg.setFields(commonName, scientificName, lifeSpan, status); mainLayout.addMember(lg); lg.fetchData(); } }
Code:
<DataSource ID="animals" serverType="sql" tableName="animals" testFileName="animals.data.xml" useAnsiJoins="true"> <fields> <field name="commonName" title="Animal" type="text" /> <field name="scientificName" title="Scientific Name" type="text" primaryKey="true" required="true" /> <field name="lifeSpan" title="Life Span" type="integer" foreignKey="supplyItem.itemID" joinType="outer" displayField="supplyItemName" /> <field name="supplyItemName" includeFrom="supplyItem.itemName" /> <field name="status" title="Endangered Status" type="text"> <valueMap> <value>Threatened</value> <value>Endangered</value> <value>Not Endangered</value> <value>Not currently listed</value> <value>May become threatened</value> <value>Protected</value> </valueMap> </field> <field name="diet" title="Diet" type="text" /> <field name="information" title="Interesting Facts" type="text" length="1000" /> <field name="picture" title="Picture" type="image" detail="true" imageURLPrefix="/isomorphic/system/reference/inlineExamples/tiles/images/" /> </fields> </DataSource>
You'll see a fetchMissingValues-request and a PickList-request, both for the lifeSpan field.
Now reopen readonly via the button:
Doubleclick the ListGrid in order to edit a row and look at the requests sent in the Developer Console.
You'll see a fetchMissingValues-request and no PickList-request.
In my opinion, the fetchMissingValues-request should be gone as well, especially as you don't use the returned value (SKU, where the normal displayField is itemName).
Best regards
Blama
Comment