我正在尝试从用作我的网格的自定义过滤器编辑器的 KendoDropDownList 中获取所选项目的数据参数。
我有:
function gradeSelector(element)
{
element.kendoDropDownList({
dataSource: {
transport: {
read: {
type: "POST",
url: ROOT+'record/fetchGrade',
dataType: 'json',
data: {
mode: 'obj'
}
}
}
},
optionLabel: "Select grade",
dataTextField: "text",
dataValueField: "id",
template: '#="<span class=\'filterTrigger\' data-value=\'"+id+"\'>"+text+"</span>" #',
select: function(e)
{// Dirty, is there a better way?
html = e.item[0].outerHTML;
html = html.substring(html.indexOf('data-value="')+12);
gradeId = html.substring(0, html.indexOf('"'));
clearSingleFilter('grade');
activeFilter.push({
field: 'grade',
operator: 'eq',
value: gradeId
})
$('.k-animation-container').hide();
filtersState = 1 ;
$('#customerGrid').data('kendoGrid').dataSource.filter(activeFilter);
}
});
}
我得到gradeId的方式看起来很乱。检索此值的正确方法是什么?