热门获取价值/文本对使用JavaScript或Jquery形成kendo下拉列表 [英] Hot to get value/text pairs form kendo dropdown using JavaScript or Jquery

查看:59
本文介绍了热门获取价值/文本对使用JavaScript或Jquery形成kendo下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用剑道下拉菜单

 // html 
< 输入 id = field_timezone style = width:275px; tabindex = 4 < span class =code-keyword>>



  //   js  
resultList = $ .parseJSON(response.d); // 数据通过ajax调用

$( #field_timezone)。kendoDropDownList({
dataTextField: TimeZoneDescription
dataValueField: TimeZoneID
dataSource:resultList,
optionLabel:{
TimeZoneDescription: 选择
TimeZoneID:
}
});



我想找到,下拉列表中应显示哪些值/文本对或选项



我尝试的东西

 alert( JSON  .stringify($(' < span class =code-string>#field_timezone')。data('  kendoDropDownList')dataSource.data()))。 
//
alert( JSON .stringify($(' #field_timezone')。data(' kendoDropDownList')。dataSource._data));



给出了用于数据源的列表,但它缺少选择选项,



没有选项可以找出哪些字段用于值或文本

解决方案

.parseJSON(response.d); // 数据通过ajax调用


#field_timezone)。kendoDropDownList({
dataTextField: TimeZoneDescription
dataValueField: TimeZoneID
dataSource:resultList,
optionLabel:{
TimeZoneDescription: 选择
TimeZoneID:
}
});



我想找到,下拉列表中应显示哪些值/文本对或选项



我尝试的东西

 alert( JSON  .stringify(

' #field_timezone')。data(' kendoDropDownList')。dataSource.data()));
//
alert( JSON .stringify(

I am using kendo dropdown like

//html
<input id="field_timezone" style="width: 275px;" tabindex="4">  


//js
resultList = $.parseJSON(response.d);   //data via ajax call

$("#field_timezone").kendoDropDownList({
    dataTextField: "TimeZoneDescription",
    dataValueField: "TimeZoneID",
    dataSource: resultList,
    optionLabel: {
        TimeZoneDescription: "Choose",
        TimeZoneID: ""
    }
});


I am trying to find, what value/text pairs or options should be displayed on the dropdown

Things I have tried

alert(JSON.stringify($('#field_timezone').data('kendoDropDownList').dataSource.data()));
//or
alert(JSON.stringify($('#field_timezone').data('kendoDropDownList').dataSource._data));


gives the list used for datasource, but it's missing the "Choose"option,

And no option to find out which fields are been used for value or text

解决方案

.parseJSON(response.d); //data via ajax call


("#field_timezone").kendoDropDownList({ dataTextField: "TimeZoneDescription", dataValueField: "TimeZoneID", dataSource: resultList, optionLabel: { TimeZoneDescription: "Choose", TimeZoneID: "" } });


I am trying to find, what value/text pairs or options should be displayed on the dropdown

Things I have tried

alert(JSON.stringify(


('#field_timezone').data('kendoDropDownList').dataSource.data())); //or alert(JSON.stringify(


这篇关于热门获取价值/文本对使用JavaScript或Jquery形成kendo下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆