Hi,
We are using
a) SmartClient Version: v9.1p_2014-05-15/Pro Deployment (built 2014-05-15)
b) Testing using IE 11.0.9600.17126
In our application, we disallow a user from tabbing into a non-editable form item. This form item may or may not start off being editable, but under some condition, at run time, we make it editable or non-editable.
We do this by allowing smartgwt to generate the tab index. So we save the generated tab index value, and then we remove it or set it back again depending on the scenerio. The setTabIndex method simply ignores the value that we reset it to. Below you will find our code. If this is not what we should be doing please let me know how we can accomplish this.
Thanks,
Voula
We are using
a) SmartClient Version: v9.1p_2014-05-15/Pro Deployment (built 2014-05-15)
b) Testing using IE 11.0.9600.17126
In our application, we disallow a user from tabbing into a non-editable form item. This form item may or may not start off being editable, but under some condition, at run time, we make it editable or non-editable.
We do this by allowing smartgwt to generate the tab index. So we save the generated tab index value, and then we remove it or set it back again depending on the scenerio. The setTabIndex method simply ignores the value that we reset it to. Below you will find our code. If this is not what we should be doing please let me know how we can accomplish this.
Thanks,
Voula
Code:
package com.example.myproject.client; import com.google.gwt.core.client.EntryPoint; 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.form.fields.FormItem; import com.smartgwt.client.widgets.form.fields.PasswordItem; import com.smartgwt.client.widgets.form.fields.TextItem; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; public class Testbutton implements EntryPoint { private TextItem usernameItem; private TextItem emailItem; private PasswordItem passwordItem; private PasswordItem password2Item; private Integer emailItemTabIndex; public void onModuleLoad() { VLayout layout = new VLayout(20); final DynamicForm form = new DynamicForm(); form.setWidth(250); usernameItem = new TextItem(); usernameItem.setTitle("Username"); usernameItem.setDefaultValue("bob"); emailItem = new TextItem(); emailItem.setTitle("Email"); emailItem.setDefaultValue("bob@isomorphic.com"); passwordItem = new PasswordItem(); passwordItem.setTitle("Password"); password2Item = new PasswordItem(); password2Item.setTitle("Password again"); password2Item.setType("password"); form.setFields(new FormItem[] {usernameItem, emailItem, passwordItem, password2Item}); IButton btnDisable = new IButton("Disable Item"); btnDisable.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { disableEmail(); } }); IButton btnEnable = new IButton("Enable Item"); btnEnable.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { enableEmail(); } }); layout.addMember(form); HLayout buttonLayout = new HLayout(10); buttonLayout.addMember(btnDisable); buttonLayout.addMember(btnEnable); layout.addMember(buttonLayout); layout.draw(); SC.say("emailItem:TabIndex: "+emailItem.getTabIndex()+""); emailItemTabIndex = emailItem.getTabIndex(); } void enableEmail(){ emailItem.setCanEdit(true); emailItem.setCanFocus(true); emailItem.setTabIndex(emailItemTabIndex); SC.say("emailItem:TabIndex: "+emailItem.getTabIndex()+""); } void disableEmail(){ emailItem.setCanEdit(false); emailItem.setCanFocus(false); emailItem.setTabIndex(-1); SC.say("emailItem:TabIndex: "+emailItem.getTabIndex()+""); } }
Comment