Hi Isomorphic,
please see this sample based on BuiltInDS:
BuiltInDS.java
animals.ds.xml
As you can see, it is not possible to select text when in ReadOnlyDisplayAppearance.DISABLED-mode. I don't think it should be this way.
Additionally in ReadOnlyDisplayAppearance.READONLY-mode, the text of field "Endangered Status" (SelectItem, <div>-based) is not selectable, while the text of the same-looking field "Endangered Status ComboBoxItem" (ComboBoxItem, <input>-based) is selectable.
Best regards,
Blama
please see this sample based on BuiltInDS:
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.Criteria;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.types.ReadOnlyDisplayAppearance;
import com.smartgwt.client.util.PageKeyHandler;
import com.smartgwt.client.util.Page;
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.DynamicForm;
import com.smartgwt.client.widgets.layout.VLayout;
public class BuiltInDS implements EntryPoint {
private DynamicForm boundForm;
private IButton toogleBtn;
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();
}
});
VLayout vLayout = new VLayout(10);
DataSource ds = DataSource.get("animals");
boundForm = new DynamicForm();
boundForm.setCanEdit(true);
boundForm.setReadOnlyDisplay(ReadOnlyDisplayAppearance.READONLY);
boundForm.setCanSelectText(true);
boundForm.setDataSource(ds);
boundForm.fetchData(new Criteria("scientificName", "Loxodonta africana"));
toogleBtn = new IButton("Toggle disabled");
toogleBtn.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (boundForm.getCanEdit()) {
boundForm.setCanEdit(false);
if (boundForm.getReadOnlyDisplay() == ReadOnlyDisplayAppearance.DISABLED) {
boundForm.setReadOnlyDisplay(ReadOnlyDisplayAppearance.READONLY);
boundForm.setCanSelectText(true);
SC.say("ReadOnlyDisplayAppearance.READONLY");
} else {
boundForm.setReadOnlyDisplay(ReadOnlyDisplayAppearance.DISABLED);
boundForm.setCanSelectText(true);
SC.say("ReadOnlyDisplayAppearance.DISABLED");
}
} else
boundForm.setCanEdit(true);
boundForm.markForRedraw("Toggled canEdit");
}
});
vLayout.setMembers(boundForm, toogleBtn);
vLayout.draw();
}
}
Code:
<DataSource ID="animals" serverType="sql" tableName="animals" testFileName="animals.data.xml"> <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" /> <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="status2" title="Endangered Status ComboBoxItem" nativeName="status" type="text" editorType="ComboBoxItem"> <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>
Additionally in ReadOnlyDisplayAppearance.READONLY-mode, the text of field "Endangered Status" (SelectItem, <div>-based) is not selectable, while the text of the same-looking field "Endangered Status ComboBoxItem" (ComboBoxItem, <input>-based) is selectable.
Best regards,
Blama
Comment