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 ...
随机推荐
- 第十三届北航程序设计竞赛决赛网络同步赛 B题 校赛签到(建树 + 打标记)
题目链接 校赛签到 对每个操作之间建立关系. 比较正常的是前$3$种操作,若第$i$个操作属于前$3$种,那么就从操作$i-1$向$i$连一条有向边. 比较特殊的是第$4$种操作,若第$i$个操作属 ...
- HDFS Scribe Integration 【转】
It is finally here: you can configure the open source log-aggregator, scribe, to log data directly i ...
- luogu P1616 疯狂的采药
题目背景 此题为NOIP2005普及组第三题的疯狂版. 此题为纪念LiYuxiang而生. 题目描述 LiYuxiang是个天资聪颖的孩子,他的梦想是成为世界上最伟大的医师.为此,他想拜附近最有威望的 ...
- 最新Webstrom, Idea 2019.1.3 的激活
1.注册码激活 打开网址(IntelliJ IDEA 注册码),我们能看到下面的界面,直接点击获取激活码,将生成的激活码粘贴到WebStorm激活对话框中的Lisence Code输入框,点击OK即可 ...
- SQLITE3 --详解
由于我主要负责我们小组项目数据库模块的部分所以这几天都一直在研究在iphone中最为常用的一个简单数据库sqlite,自己也搜集很多资料,因此在 这里总结一下这几天的学习成果: Sqlite 操作简明 ...
- 终端应用变身文件 MD5/SHA1 校验工具
担心下载的文件被恶意篡改?没有找到 Mac 平台文件校验工具?其实 Mac OS X 系统中已经内置了“文件 MD5/SHA1 校验工具”,它就藏身于终端(Terminal)应用中! 打开终端应用,输 ...
- linux 下 ifcfg-eth0 配置 以及ifconfig、ifup、ifdown区别
这3个命令的用途都是启动网络接口,不过,ifup与ifdown仅就 /etc/sysconfig/network- scripts内的ifcfg-ethx(x为数字)进行启动或关闭的操作,并不能直接修 ...
- DesignSurface简介
The Perfect Host: Create And Host Custom Designers With The .NET Framework 2.0 Dinesh Chandnani - 三月 ...
- JVM —— 移除永久代
近期准备生产环境 JDK 升级到 1.8,本地先升级了下,发现 -XX:PermSize 和 -XX:MaxPermSize 已经失效,取而代之的是一个新的区域 -- Metaspace(元数据区). ...
- U盘启动盘恢复为普通盘
U盘启动盘恢复为普通盘 此操作必须借助软件完成. 所用软件:diskgenius 下载地址: https://pan.baidu.com/s/1geDkK7L 密码: 8888 先将u盘中文件拷贝 ...