jquery dropdownlist.js
- $.fn.extend({
- SetDict: function (option) {
- var txtControl = $(this);
- if (!txtControl.hasClass("combo-text")) {
- // var width = txtControl.width();
- //txtControl.addClass("combo");
- }
- txtControl.click(function () {
- var obj = option.valueControl;
- var dicType = option.dicType;
- var isShow = txtControl.attr("isShow");
- if (isShow == null || isShow == "") {
- txtControl.attr("isShow", "");
- txtControl.combogrid({
- panelWidth: ,
- idField: 'Code',
- textField: 'Name',
- url: '/Common/EntityJsonList.ashx?_method=dict&dictType=' + dicType + "&tmp=" + Math.random() + '&queryTextFild=Name',
- method: 'get',
- delay: ,
- columns: [[
- { field: 'Name', title: '名称', width: },
- { field: 'Code', title: '编码', width: }
- ]],
- striped: true,
- editable: true,
- collapsible: false, //是否可折叠的
- fit: true,
- onLoadSuccess: function () {
- window.setTimeout(function () {
- $(".combo-arrow", option.valueControl.parent()).click();
- }, );
- },
- onClickRow: function (index, row) {
- txtControl.val(row.Name);
- option.valueControl.val(row.Code);
- }, //自动大小
- keyHandler: {
- up: function () { //【向上键】押下处理
- //取得选中行
- var selected = txtControl.combogrid('grid').datagrid('getSelected');
- if (selected) {
- //取得选中行的rowIndex
- var index = txtControl.combogrid('grid').datagrid('getRowIndex', selected);
- txtControl.val(selected.Name);
- option.valueControl.val(selected.Code);
- //向上移动到第一行为止
- if (index > ) {
- txtControl.combogrid('grid').datagrid('selectRow', index - );
- }
- } else {
- var rows = txtControl.combogrid('grid').datagrid('getRows');
- txtControl.combogrid('grid').datagrid('selectRow', rows.length - );
- }
- },
- down: function () { //【向下键】押下处理
- //取得选中行
- var selected = txtControl.combogrid('grid').datagrid('getSelected');
- if (selected) {
- txtControl.val(selected.Name);
- option.valueControl.val(selected.Code);
- //取得选中行的rowIndex
- var index = txtControl.combogrid('grid').datagrid('getRowIndex', selected);
- //向下移动到当页最后一行为止
- if (index < txtControl.combogrid('grid').datagrid('getData').rows.length - ) {
- txtControl.combogrid('grid').datagrid('selectRow', index + );
- }
- } else {
- txtControl.combogrid('grid').datagrid('selectRow', );
- }
- },
- enter: function () { //【回车键】押下处理
- txtControl.combogrid('hidePanel');
- var selected = txtControl.combogrid('grid').datagrid('getSelected');
- if (selected) {
- txtControl.val(selected.Name);
- option.valueControl.val(selected.Code);
- }
- },
- query: function (keyword) { //【动态搜索】处理
- //设置查询参数
- var queryParams = txtControl.combogrid("grid").datagrid('options').queryParams;
- queryParams.keyword = keyword;
- txtControl.combogrid("grid").datagrid('options').queryParams = queryParams;
- //重新加载
- txtControl.combogrid("grid").datagrid("reload");
- txtControl.combogrid("setValue", keyword);
- }
- },
- mode: 'remote',
- fitColumns: true
- });
- }
- });
- }
- });
- $.fn.extend({
- SetCombo: function (option) {/// <reference path="../Common/JGridJson.cs" />
- var entityType = option.entityType;
- var textField = option.textField;
- var textControl = $(this);
- var panelWidth = option.panelWidth;
- var idFild = option.idFild;
- var valueControl = option.valueControl;
- var panelHeight = option.panelHeight;
- var columns = option.columns;
- var where = option.where;
- //var keyword = option.keyword;
- var pageSize = option.pageSize;
- if (option.pageSize == null) {
- pageSize = ;
- }
- var obj = valueControl;
- if (panelHeight == null) {
- panelHeight = ;
- }
- var url = '/common/EntityJsonList.ashx?entityType=' + option.entityType + '&_method=entity&tmp=' + Math.random() + '&queryTextFild=' + textField;
- if (where) {
- url += "&where=" + where;
- }
- if (panelWidth == null) {
- panelWidth = ;
- }
- if (valueControl.val() != "") {
- url += "&defaultValue=" + escape(valueControl.val());
- }
- var id = 'Id';
- if (idFild != null) {
- id = idFild;
- }
- url += "&idFild=" + id;
- textControl.click(function () {
- var a = textControl.attr("isShow");
- if (a == "" || a == null) {
- textControl.attr("isShow", "");
- textControl.combogrid({
- panelWidth: panelWidth,
- panelHeight: panelHeight,
- idField: id,
- textField: textField,
- url: url,
- method: 'get',
- delay: ,
- pagination: true, //是否分页
- rownumbers: true, //序号
- pageSize: pageSize, //每页显示的记录条数,默认为10
- pageList: [pageSize, , , , , , , ], //可以设置每页记录条数的列表
- columns: columns,
- striped: true,
- editable: true,
- collapsible: false, //是否可折叠的
- fit: true,
- onLoadSuccess: function () {
- window.setTimeout(function () {
- $(".combo-arrow", option.valueControl.parent()).click();
- }, );
- },
- onClickRow: function (index, row) {
- valueControl.val(UTIL.getJsonByKey(row, idFild));
- textControl.val(UTIL.getJsonByKey(row, textField));
- }, //自
- keyHandler: {
- up: function () { //【向上键】押下处理
- //取得选中行
- var selected = textControl.combogrid('grid').datagrid('getSelected');
- if (selected) {
- //取得选中行的rowIndex = txtControlex
- var index = combogrid('grid').datagrid('getRowIndex', selected);
- valueControl.val(UTIL.getJsonByKey(selected, idFild));
- textControl.val(UTIL.getJsonByKey(selected, textField));
- //向上移动到第一行为止
- if (index > ) {
- textControl.combogrid('grid').datagrid('selectRow', index - );
- }
- } else {
- var rows = textControl.combogrid('grid').datagrid('getRows');
- textControl.combogrid('grid').datagrid('selectRow', rows.length - );
- }
- },
- down: function () { //【向下键】押下处理
- //取得选中行
- var selected = textControl.combogrid('grid').datagrid('getSelected');
- if (selected) {
- valueControl.val(UTIL.getJsonByKey(selected, idFild));
- textControl.val(UTIL.getJsonByKey(selected, textField));
- //取得选中行的rowIndex
- var index = textControl.combogrid('grid').datagrid('getRowIndex', selected);
- //向下移动到当页最后一行为止
- if (index < textControl.combogrid('grid').datagrid('getData').rows.length - ) {
- textControl.combogrid('grid').datagrid('selectRow', index + );
- }
- } else {
- textControl.combogrid('grid').datagrid('selectRow', );
- }
- },
- enter: function () { //【回车键】押下处理
- textControl.combogrid('hidePanel');
- var selected = textControl.combogrid('grid').datagrid('getSelected');
- if (selected) {
- valueControl.val(UTIL.getJsonByKey(selected, idFild));
- textControl.val(UTIL.getJsonByKey(selected, textField));
- }
- },
- query: function (keyword) { //【动态搜索】处理
- //设置查询参数
- var queryParams = textControl.combogrid("grid").datagrid('options').queryParams;
- queryParams.keyword = keyword;
- textControl.combogrid("grid").datagrid('options').queryParams = queryParams;
- //重新加载
- textControl.combogrid("grid").datagrid("reload");
- textControl.combogrid("setValue", keyword);
- }
- },
- mode: 'remote',
- fitColumns: true
- });
- }
- });
- }
- });
jquery dropdownlist.js的更多相关文章
- jquery.validate.js表单验证
一.用前必备官方网站:http://bassistance.de/jquery-plugins/jquery-plugin-validation/ API: http://jquery.bassist ...
- MVC - 11(下)jquery.tmpl.js +ajax分页
继续 mvc-11(上).dto:http://www.cnblogs.com/tangge/p/3840060.html jquery.tmpl.js 下载:http://pan.baidu.com ...
- 【转】jquery.validate.js表单验证
一.用前必备官方网站:http://bassistance.de/jquery-plugins/jquery-plugin-validation/ API: http://jquery.bassist ...
- [转]jquery.validate.js表单验证
原文地址:https://www.cnblogs.com/si-shaohua/p/3780321.html 一.用前必备官方网站:http://bassistance.de/jquery-plugi ...
- jquery和Js的区别和基础操作
jqery的语法和js的语法一样,算是把js升级了一下,这两种语法可以一起使用,只不过是用jqery更加方便 一个页面想要使用jqery的话,先要引入一下jqery包,jqery包从网上下一个就可以, ...
- jQuery.template.js 简单使用
之前看了一篇文章<我们为什么要尝试前后端分离>,深有同感,并有了下面的评论: 我最近也和前端同事在讨论这个问题,比如有时候前端写好页面给后端了,然后后端把这些页面拆分成很多的 views, ...
- 修改 jquery.validate.js 支持非form标签
尝试使用markdown来写一篇blog,啦啦啦 源代码传送门:github 在特殊情况下我们使用jquery.validate.js对用户输入的内容做验证的时候,表单并不是一定包含在form之中,有 ...
- 表单验证插件之jquery.validate.js
提到表单验证的插件,第一个想到的就是jquery.validate.js,所以小生想在这里稍微详细地说一下这款插件的具体使用方法,便于理解,我直接附上整段demo的代码(没怎么调样式,主要是看js): ...
- 延迟加载外部js文件,延迟加载图片(jquery.lazyload.js和echo,js)
js里一说到延迟加载,大都离不开两种情形,即外部Js文件的延迟加载,以及网页图片的延迟加载: 1.首先简单说一下js文件的3种延迟加载方式: (1)<script type="text ...
随机推荐
- 串口通信(C#实践)
最近在做一个和智能硬件设备(数字焊接电源)通信的应用软件.和各设备之间通信使用的是串口或网络(Socket)的方式. 理论 串口通信,.NET 里提供了专门操作串口的类 System.IO.Ports ...
- 洛谷 P1930 亚瑟王的宫殿 Camelot
传送门 题目大意:棋盘有骑士有王,让所有点跳到一个点,求所有棋子跳的步数和,和最小. 题解:bfs+枚举 王的人生: 1):自己走到聚集点 2):某个骑士来到王这里,两个棋子一起到聚集点 3):王走几 ...
- 2.2 web工程的目录结构
[转] 一个最简单的Web应用的目录结构如下所示: Web应用的结构定义在Servlet的规范中,目前最新版本为3.1. 下载地址:https://jcp.org/aboutJava/communit ...
- SQL语句优化方法30例
1. /*+ALL_ROWS*/ 表明对语句块选择基于开销的优化方法,并获得最佳吞吐量,使资源消耗最小化. 例如: SELECT /*+ALL+_ROWS*/ EMP_NO,EMP_NAM,DAT_I ...
- sublime 工具
http://blog.csdn.net/admin_yi/article/details/53608965
- POJ2478(欧拉函数)
Farey Sequence Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 15242 Accepted: 6054 D ...
- mina2中IoHandler
IoHandler 当我们通过IoSession执行相关操作的时候,如写数据,这些事件会触发Mina框架抽象的IoService实例,从而调用Mina框架底层的相关组件进行处理.这时,配置的IoHan ...
- C#简单操作XML
类文件: class OperatorXML { /// <summary> /// 确定资源文件路径,Resource为自己创建的目录 /// </summary> priv ...
- C# 获取天气 JSON解析
说明: winform获取中国天气的数据 中国天气返回的是JSON数据格式,这里做简单的解析. 用的http://www.weather.com.cn/data/sk/.html获取的天气. [ ...
- mysql流程控制
一 流程控制 delimiter // CREATE PROCEDURE proc_if () BEGIN declare i int default 0; if i = 1 THEN SELECT ...