Easyui combobox 怎么加载数据
说明:开发环境 vs2012 asp.net mvc4 c#
1、效果图

2、HTML代码
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EasyuiCombotree.aspx.cs" Inherits="MvcAppTest.EasyuiCombotree" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Easyui Combotree 测试</title>
<link href="Easyui/themes/default/easyui.css" rel="stylesheet" />
<script src="Easyui/jquery-1.7.2.js"></script>
<script src="Easyui/jquery.easyui.min.js"></script>
<script src="Easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
$(function () {
$('#cc').combobox({
url: 'Home/getOffice',
valueField: 'id',
textField: 'text',
required: true,
queryParams: { OFFID: 100 },
editable: false,//不可编辑,只能选择
disabled: false,
value: '选择部门'
});
});
function getValue()
{
var value = $('#cc').combobox('getValue');
alert(value);
}
function getText()
{
var text = $('#cc').combobox('getText');
alert(text);
}
</script>
</head>
<body>
<input id="cc" name="dept" value="" />
<div><input type="button" value="获取Value的值" style="width:100px;" onclick="getValue()"/> <input type="button" value="获取text的值" onclick="getText()" style="width:100px;" /></div>
<div style="height:30px;"></div>
<span>combobox 另一种定义形式</span>
<div>
<select id="Select1" class="easyui-combobox" name="dept" style="width:200px;">
<option value="aa">aitem1</option>
<option>bitem2</option>
<option>bitem3</option>
<option>ditem4</option>
<option>eitem5</option>
</select>
</div>
</body>
</html>
3、Home后台代码
public JsonResult getOffice(string OFFID)
{
Int32 officeID = Convert.ToInt32(OFFID);
List<ComboModel> myList = new List<ComboModel>(); for (int i = ; i < ; i++)
{
ComboModel model = new ComboModel()
{
id=i,
text="部门"+i.ToString()
};
myList.Add(model);
} return Json(myList, JsonRequestBehavior.DenyGet);
}
public class ComboModel
{
public System.Int32 id { get; set; }
public System.String text { get; set; }
}
Easyui combobox 怎么加载数据的更多相关文章
- easyui combobox 动态加载数据C#
<script type="text/javascript" src="Scripts/jquery-1.8.2.min.js"></scri ...
- easyui datagrid 异步加载数据时滚动条有时会自动滚到最底部的问题
在使用easyui 的datagrid异步加载数据时发现滚动条有时会自动滚到最底部.经测试发现,如果加载数据前没有选中行则不会出现这个问题.这样我们可以在重新异步加载数据前取消选中行就可以避免这个问题 ...
- easyui combobox 动态加载数组数据
怕自己忘了,记录下来以后用方便 html部分 <input id="rzcode" name="businesItemId" style="wi ...
- combobox远程加载数据的总结和Json数据的小结
1.从后台返回请求加载Combobox下拉框数据 html部分1 <select name="mateBelongZ" id="mateBelongZID" ...
- easyui combobox 动态加载的两种方法
reload 方法 javascript代码 //指定id 和 text 否则始终选择第一个 $('#contact_city').combobox({ valueField:'id', textFi ...
- easyui datagrid 动态加载数据 渲染问题,表格错位问题
$('#dg').datagrid({ url:'datagrid_data.json', columns:[[ {field:'code',title:'Code',width:100}, {fie ...
- jquery easyui datagrid 远程加载数据----把主键渲染为值遇到的问题及解决方案
起因:数据库中一些字段存的是代表具体值的数字,需要渲染为具体值 monggodb中的字典 mysql中存放的值为:expertin代表教练擅长的搏击技能 jquery easyui中的相关代码如下:用 ...
- jquery easyui datagrid 远程加载数据----javascript法
jquery easyui有三种办法生成datagrid(数据网格),本篇专门讨论javascript借助jquey easy ui实现的方式 html部分 <main role="m ...
- EasyUI 的 combotree 加载数据后折叠起来,并且只允许单击子节点的写法
$(source).combotree({ url: '', width: kuan, valueField: 'id', textField: 'text', onlyLeafCheck: true ...
随机推荐
- 牛客网 牛客练习赛13 B.幸运数字Ⅱ-数组 or DFS
B.幸运数字Ⅱ 链接:https://www.nowcoder.com/acm/contest/70/B来源:牛客网 这个题就是找出来数据范围内的所有的幸运数,然后直接区间累加起来就可以了. ...
- UVA 524 素数环 【dfs/回溯法】
Description A ring is composed of n (even number) circles as shown in diagram. Put natural numbers ...
- Linux下Shell文件内容替换(sed)(转)
sed -i 's/被替换的内容/要替换成的内容/g' file #-i为直接修改并保存 参考: http://blog.sina.com.cn/s/blog_7211cb9201019hgd.htm ...
- Windows 10系统出现:“出现系统还原使用的卷影复制服务无法运行...”的问题解决
在服务中是:Volume Shadow Copy和Microsoft Software Shadow Copy Provider这两项.把它开启.
- Delphi Integer 转成单字节
整形不能超过256 b:=Byte(StrToInt(n)); var s: string; b: Byte; begin s := Edit1.Text; b := Byte(Str ...
- 由ASIHttpRequest里的block引发的思考
项目发http请求,现在一般的都是用的第三方开源库,当然发异步请求时我们也会写几个回调函数来进行请求返回时的处理.不过前段时间看一个朋友写的代码,里面很用block简单的实现了回调相关的部分.比如: ...
- HDU 3150 Robot Roll Call – Cambot…Servo…Gypsy…Croooow(map)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3150 Problem Description Mystery Science Theater 3000 ...
- 七天学会ASP.NET MVC(七)——创建单页应用 【转】
http://www.cnblogs.com/powertoolsteam/p/MVC_Seven.html 系列文章 七天学会ASP.NET MVC (一)——深入理解ASP.NET MVC 七天学 ...
- Performing User-Managed Database-18.7、Performing Complete User-Managed Media Recovery
18.7.Performing Complete User-Managed Media Recovery 完毕一致性备份,把数据库恢复到当前的scn是最好的结果.能够恢复整个数据库.恢复单个表空间.或 ...
- SPA路由机制详解(看不懂不要钱~~)
前言 总所周知,随着前端应用的业务功能起来越复杂,用户对于使用体验的要求越来越高,单面(SPA)成为前端应用的主流形式.而大型单页应用最显著特点之一就是采用的前端路由跳转子页面系统,通过改变页面的UR ...