首页 新闻 会员 周边

easy ui中ComboBox数据显示问题

0
悬赏园豆:15 [待解决问题]

我写了一个ComboBox的代码但是运行时不显示数据,希望大神看下是哪里出错了,代码如下

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ComboBox.aspx.cs" Inherits="WebEasyUi.WebForm2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ComboBox</title>
<link href="jquery-easyui-1.3.2/themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link href="jquery-easyui-1.3.2/themes/icon.css" rel="stylesheet" type="text/css" />
<script src="jquery-easyui-1.3.2/jquery-1.8.0.min.js" type="text/javascript"></script>
<script type="text/javascript" src="jquery-easyui-1.3.2/jquery.easyui.min.js"></script>
<script type="text/javascript">
function setValue() {
function loadData() {
$('#cc').combobox({
url: 'F:\vs2008\WebEasyUi\WebEasyUi\jquery-easyui-1.3.2\demo\combobox\combobox_data1.json',
valueField: 'id',
textField: 'text'
});
}
$('#cc').combobox('setValue');
}
function getValue() {
var val = $('#cc').combobox('getValue');
alert(val);
}
function disable() {
$('#cc').combobox('disable');
}
function enable() {
$('#cc').combobox('enable');
}
$(function() {
$('#cc').combobox({
width: 150,
listWidth: 150,
valuefield:'id',
textField:'text',
url: 'F:\vs2008\WebEasyUi\WebEasyUi\jquery-easyui-1.3.2\demo\combobox\combobox_data1.json',
editable: false
});
});
</script>
</head>

<body>
<h1>ComboBox</h1>
<form id="form1" runat="server">
<div style="margin-bottom:10px;"><a href="#" onclick="setValue()">setValue</a>
<a href="#" onclick="getValue()">getValue</a><a href="#" onclick="disable()">disable</a>
<a href="#" onclick="enable()">enable</a>
</div>
<span>Options:</span>
<select id="cc" name="dept" required="true">
<option></option>
<%-- <option value="">==请选择==</option>
<option value="0">苹果</option>
<option value="1">香蕉</option>--%>
</select>
</form>
</body>
</html>

其中combobox_data1.json的内容如下

[{
"id":1,
"text":"Java",
"desc":"Write once, run anywhere"
},{
"id":2,
"text":"C#",
"desc":"One of the programming languages designed for the Common Language Infrastructure"
},{
"id":3,
"text":"Ruby",
"selected":true,
"desc":"A dynamic, reflective, general-purpose object-oriented programming language"
},{
"id":4,
"text":"Perl",
"desc":"A high-level, general-purpose, interpreted, dynamic programming language"
},{
"id":5,
"text":"Basic",
"desc":"A family of general-purpose, high-level programming languages"
}]

 

wyz3210的主页 wyz3210 | 初学一级 | 园豆:21
提问于:2014-02-28 09:31
< >
分享
所有回答(1)
0

同问,遇到同样的问题

Daniel wang | 园豆:166 (初学一级) | 2014-12-24 16:16
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册