PDA

View Full Version : [CLOSED] TriggerField KeyDown not workingin Razor



mbGriffel
Oct 02, 2012, 12:28 PM
Can't get TriggerField -> DirectEvent -> KeyDown working in Razor.
Works fine with standard ASPX view engine.

TriggerClick event in example code works fine.

Using Ext.Net v2.1



@using Ext.Net
@using Ext.Net.MVC
@model ContactService.DataTransferObject.ContactDto

@(Html.X().GridPanel()
.ID("GridPanel")
.Layout("fit")
.ForceFit(true)
.Border(false)
.Store(
Html.X().StoreFor<ContactService.DataTransferObject.ContactDto>()
)
.ColumnModel(
Html.X().ColumnFor(m => m.Name),
Html.X().ColumnFor(m => m.CustomerNumber),
Html.X().ColumnFor(m => m.City),
Html.X().ColumnFor(m => m.Phone)
)
.TopBar(
Html.X().Toolbar()
.Items(
Html.X().TriggerField()
.ID("SearchTriggerField")
.EmptyText("Search Contact")
.Triggers(collection => collection.Add(Html.X().FieldTrigger().Icon(Trigge rIcon.Search)))
.DirectEvents(e =>
{
e.TriggerClick.Url = Url.Action("Search");
e.TriggerClick.Success = "GExt.Grid.UpdateStore(App.GridPanel, result.data, true);";
e.TriggerClick.ExtraParams.Add(new Parameter("filter", "App.SearchTriggerField.getValue()", ParameterMode.Raw));

e.KeyDown.Url = Url.Action("Search");
e.KeyDown.Buffer = 200;
e.KeyDown.Success = "GExt.Grid.UpdateStore(App.GridPanel, result.data, true);";
e.KeyDown.ExtraParams.Add(new Parameter("filter", "App.SearchTriggerField.getValue()", ParameterMode.Raw));
})
)
))



Doing anything wrong?

Daniil
Oct 02, 2012, 2:13 PM
Hi @mbGriffel,

Welcome to Ext.NET!

I think you should set

.EnableKeyEvents(true)
for the TriggerField.

See also
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.Text-cfg-enableKeyEvents

mbGriffel
Oct 03, 2012, 7:28 AM
Hi @mbGriffel,

.EnableKeyEvents(true)


That worked, thx Daniil!

Daniil
Oct 03, 2012, 10:56 AM
Glad to help.

By the way, it should not work without this property in WebForm as well.