I have a dropdown list that has a source where multiple items have to be displayed based on a parameter. I have activated the virtualization and a method of ValueMapper has to be provided.
@(Html.Kendo()
.DropDownListFor(model => model.<UnknownProperty>)
.DataTextField(
"Name"
)
.DataValueField(
"Id"
)
.Filter(FilterType.Contains)
.DataSource(source =>
{
source.Ajax().Read(
"Action"
,
"Controller"
,
new
{ id = Model.Id }).PageSize(100);
})
.Virtual(v => v.ItemHeight(26).ValueMapper(
"valuemapper"
))
// I amtr
.HtmlAttributes(
new
{ @
class
=
"form-control"
, data_mapperurl = Url.Action(
"OtherAction"
,
"Controller"
,
new
{ id = Model.Id }) })
)
On this javascript function I have to call again using ajax but I have to send also the datasource parameter.
function
manufacturerMapper(options) {
var
url;
// url = ?.data('mapperurl');
$.ajax({
url: url,
data: convertValues(options.value),
success:
function
(data) {
options.success(data);
}
});
}
Is there a way from the ValueMapper function to get to the dropdownlist? I do not want to know the name of the dropdownlist because this functionality should be used by multiple dropdownlists.
I tried to get to the dropdownlist from the this object but it seems that the function is called in the context of some kind of virtual object and not the dropdownlist