Sep 27, 2012, 6:17 AM
[CLOSED] MVC DirectEvent/Method ComboBox - Loading Data
I have a combobox with which I am trying to load data via a DirectMethod. I have been reviewing this sample: https://examples2.ext.net/#/Form/Com...Linked_Combos/. However, I think there must be some difference to implementing this correctly in MVC. I am not getting any data back. Is there something obvious I am missing?
Here is my view:
Here is my view:
@(Html.X.Window().ID("winReinsurerContacts") _
.Hidden(True) _
.Width(300) _
.Height(150) _
.Title("Edit Contact") _
.BodyPadding(5) _
.Resizable(False) _
.Closable(False) _
.Center() _
.Modal(True) _
.Layout(LayoutType.Anchor) _
.Icon(Icon.Application) _
.Items(
Html.X.Hidden().ID("reinsurerRecordID"),
Html.X.Hidden().ID("reinsurerID"),
Html.X.ComboBox().ID("cboReinsurerLookup").FieldLabel("Contact") _
.DisplayField("Text") _
.ValueField("Value") _
.Store(Html.X.Store.ID("wreinsurerContactStore") _
.DirectEvents(sub(evts)
evts.Load.Url = Url.Action("ReinsurerContacts", New With {.reinsurerID = 0})
End Sub) _
.AutoLoad(False) _
.Model(Html.X.Model.Fields(
Html.X.ModelField.Name("Value"),
Html.X.ModelField.Name("Text"))
)
)
) _
.Buttons(Html.X.Button().Icon(Icon.Accept).Text("Update").Listeners(Sub(lstnr)
lstnr.Click.Handler = "alert('got it!');"
End Sub),
Html.X.Button().Icon(Icon.Cancel).Text("Cancel").Listeners(Sub(lstnr)
lstnr.Click.Handler = "#{winReinsurerContacts}.hide();"
End Sub))
)
Here is the controller:<DirectMethod()> _
Function ReinsurerContacts(ByVal reinsurerID As Integer) As ActionResult
Dim rslt As New StoreResult()
Dim o As New List(Of Object)
Dim cbo As Ext.Net.ComboBox
cbo = Me.GetCmp(Of Ext.Net.ComboBox)("cboReinsurerLookup")
o.Add(New With {.Text = "Hello", .Value = "0"})
o.Add(New With {.Text = "Hello1", .Value = "1"})
cbo.GetStore().DataSource = o
cbo.DataBind()
Return Me.Direct()
End Function
Last edited by Daniil; Sep 28, 2012 at 4:26 AM.
Reason: [CLOSED]