Kendo ComboBox 并将附加数据传递给控制器
Kendo ComboBox and passing additional data to controller
所以我在可重复使用的局部视图中有一个 ComboBox。当我尝试使用 getAddionalData 并将更多参数传递给控制器时,有没有办法可以将组合框的输入传递给函数?我不能直接调用组合框的 id 来获取 getAddionalData 中的值,因为可能有多个,我不知道调用该函数的确切 id。我试图在函数中使用 'this' 限定符,但这只会给我读取的 url 。例如,在 dataBound 函数上,我可以调用 this.open() 并且它会打开我的组合框。我不能在这里使用它。任何的想法?我查看了 Kendo : ComboBox in a grid - Sending additional data of selected combobox to combobox Read() 并没有得到我需要的东西。
@(Html.Kendo().ComboBoxFor(m=>m.Id)
.DataTextField("xxxx")
.DataValueField("xxxx")
.Placeholder("xxxx")
.MinLength(3)
.AutoBind(false)
.Events(e=>e.DataBound("functionCall").Change("functionCall"))
.TemplateId("templateId")
.HtmlAttributes(new { @class = "form-control", style = "width:100%" })
.Filter("contains")
.Delay(500)
.DataSource(source => source.Read(read => read.Action("method", "controller").Data("getAdditionalData(#=input.val()#)"))
.ServerFiltering(true))
.Height(500)
)
var getAdditionalData = function (e) {
//somehow get id of combobox calling the function and get the value of the input to pass to controller
//can't use 'this' or e.sender
return {
text: value,
searchLocation: "xxxx",
searchType: "xxxx"
}
}
根据 Telerik,http://www.telerik.com/forums/how-to-find-id-of-kendo-dropdownlist-in-event-handler,"The Kendo UI DataSource does not know anything about the widget, which is bound to ( including the id of the DropDownList widget)"。所以看起来这不可能。
所以我在可重复使用的局部视图中有一个 ComboBox。当我尝试使用 getAddionalData 并将更多参数传递给控制器时,有没有办法可以将组合框的输入传递给函数?我不能直接调用组合框的 id 来获取 getAddionalData 中的值,因为可能有多个,我不知道调用该函数的确切 id。我试图在函数中使用 'this' 限定符,但这只会给我读取的 url 。例如,在 dataBound 函数上,我可以调用 this.open() 并且它会打开我的组合框。我不能在这里使用它。任何的想法?我查看了 Kendo : ComboBox in a grid - Sending additional data of selected combobox to combobox Read() 并没有得到我需要的东西。
@(Html.Kendo().ComboBoxFor(m=>m.Id)
.DataTextField("xxxx")
.DataValueField("xxxx")
.Placeholder("xxxx")
.MinLength(3)
.AutoBind(false)
.Events(e=>e.DataBound("functionCall").Change("functionCall"))
.TemplateId("templateId")
.HtmlAttributes(new { @class = "form-control", style = "width:100%" })
.Filter("contains")
.Delay(500)
.DataSource(source => source.Read(read => read.Action("method", "controller").Data("getAdditionalData(#=input.val()#)"))
.ServerFiltering(true))
.Height(500)
)
var getAdditionalData = function (e) {
//somehow get id of combobox calling the function and get the value of the input to pass to controller
//can't use 'this' or e.sender
return {
text: value,
searchLocation: "xxxx",
searchType: "xxxx"
}
}
根据 Telerik,http://www.telerik.com/forums/how-to-find-id-of-kendo-dropdownlist-in-event-handler,"The Kendo UI DataSource does not know anything about the widget, which is bound to ( including the id of the DropDownList widget)"。所以看起来这不可能。