Aug 05, 2014, 6:20 PM
[CLOSED] Field focus problem
I have 2 tab inside a tabpanel .I want to set focus when TAB key press on F 1 field then F 2 of TAB 2 is focused and mouse cursor pointed to F 2 .but the problem is instead of F 2 ,F 3 got focused .
@using Ext.Net
@using Ext.Net.MVC
@{
var X = Html.X();
}
<script>
var SwitchTab = function (Tabpanel, Panel) {
console.log(Tabpanel)
console.log(Panel)
if (Panel != 'null' && Tabpanel != 'null') {
Tabpanel.setActiveTab(Panel);
}
}
var SetFocus = function (Item) {
console.log(Item);
Item.focus();
}
</script>
@X.ResourceManager()
@(
X.FormPanel()
.Items(
X.TabPanel().Border(false).BodyStyle("background-color: #F1F1F1;").ID("wintabpanel")
.Items(
// TAB
X.Panel().Width(480).Padding(5).Layout(LayoutType.VBox).LayoutConfig(new VBoxLayoutConfig { Align = VBoxAlign.Stretch }).AutoScroll(true)
.ID("t1").Title("TAB 1")
.Items(
X.NumberField()
.ID("f1")
.FieldLabel("F 1")
.AnchorHorizontal("100%")
.AllowBlank(true)
.EmptyText("0")
.EmptyValue(0)
.LabelWidth(100)
.InputWidth(125)
.LabelAlign(LabelAlign.Left)
.Listeners(l => { l.SpecialKey.Handler = @"if (e.keyCode == 9)
{
SwitchTab(#{wintabpanel},#{t2})
SetFocus(#{f2});
}"; })),
X.Panel().Width(480).Padding(5).Layout(LayoutType.VBox).LayoutConfig(new VBoxLayoutConfig { Align = VBoxAlign.Stretch }).AutoScroll(true)
.ID("t2").Title("TAB 2")
.Items(
X.TextArea()
.ID("f2")
.FieldLabel("F 2")
.AnchorHorizontal("100%")
.AllowBlank(true)
.EmptyText("0")
.EmptyValue(0)
.LabelWidth(100)
.InputWidth(125)
.LabelAlign(LabelAlign.Left),
X.TextField()
.ID("f3")
.FieldLabel("F 3")
.AnchorHorizontal("100%")
.AllowBlank(true)
.EmptyText("0")
.EmptyValue(0)
.LabelWidth(100)
.InputWidth(125)
.LabelAlign(LabelAlign.Left)
)
)
))
please check the sample.
Last edited by Daniil; Feb 17, 2015 at 11:45 AM.
Reason: [CLOSED]