$.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的更多相关文章

  1. jquery.validate.js表单验证

    一.用前必备官方网站:http://bassistance.de/jquery-plugins/jquery-plugin-validation/ API: http://jquery.bassist ...

  2. MVC - 11(下)jquery.tmpl.js +ajax分页

    继续 mvc-11(上).dto:http://www.cnblogs.com/tangge/p/3840060.html jquery.tmpl.js 下载:http://pan.baidu.com ...

  3. 【转】jquery.validate.js表单验证

    一.用前必备官方网站:http://bassistance.de/jquery-plugins/jquery-plugin-validation/ API: http://jquery.bassist ...

  4. [转]jquery.validate.js表单验证

    原文地址:https://www.cnblogs.com/si-shaohua/p/3780321.html 一.用前必备官方网站:http://bassistance.de/jquery-plugi ...

  5. jquery和Js的区别和基础操作

    jqery的语法和js的语法一样,算是把js升级了一下,这两种语法可以一起使用,只不过是用jqery更加方便 一个页面想要使用jqery的话,先要引入一下jqery包,jqery包从网上下一个就可以, ...

  6. jQuery.template.js 简单使用

    之前看了一篇文章<我们为什么要尝试前后端分离>,深有同感,并有了下面的评论: 我最近也和前端同事在讨论这个问题,比如有时候前端写好页面给后端了,然后后端把这些页面拆分成很多的 views, ...

  7. 修改 jquery.validate.js 支持非form标签

    尝试使用markdown来写一篇blog,啦啦啦 源代码传送门:github 在特殊情况下我们使用jquery.validate.js对用户输入的内容做验证的时候,表单并不是一定包含在form之中,有 ...

  8. 表单验证插件之jquery.validate.js

    提到表单验证的插件,第一个想到的就是jquery.validate.js,所以小生想在这里稍微详细地说一下这款插件的具体使用方法,便于理解,我直接附上整段demo的代码(没怎么调样式,主要是看js): ...

  9. 延迟加载外部js文件,延迟加载图片(jquery.lazyload.js和echo,js)

    js里一说到延迟加载,大都离不开两种情形,即外部Js文件的延迟加载,以及网页图片的延迟加载: 1.首先简单说一下js文件的3种延迟加载方式: (1)<script type="text ...

随机推荐

  1. Linq:从List列表中查询数据(Where查询)

    获取List<Customer> customerList的函数见:http://www.cnblogs.com/yf2011/p/3369927.html 输出List中Berlin城市 ...

  2. Webpack-dashboard 简单使用

    1. 安装 npm install webpack-dashboard --save-dev 2. 配置说明 webpack config // Import the plugin: var Dash ...

  3. PHP 操作XML文档

    <<<操作符需PHP5.3以上版本才能支持,下面程序在wamp环境下测试完成. <?php // Set the content type to be XML, so that ...

  4. str_split的用法(PHP学习)

    str_split的用法: 先看看PHP手册是怎么说的 array str_split ( string $string [, int $split_length = 1 ] ) str_split返 ...

  5. layui与layer同时引入冲突的问题

    之前在项目中只有用layer,但是后来有用到了layui,结果发现同时引入这两个东东 会出现冲突的问题 导致代码运行不正常 后来网上找到了解决办法: 学习源头:http://fly.layui.com ...

  6. Spring Cloud Eureka 注册,发布,调用服务

    Spring Cloud为服务治理做了一层抽象接口,所以在Spring Cloud应用中可以支持多种不同的服务治理框架,如Netflix Eureka.Consul和Zookeeper.在Spring ...

  7. Uploadify在asp.net下使用Demo

    为了使自己以后不再去网上搜索,特记录下来 从uploadify官网http://www.uploadify.com/上下载文件 必要的文件: 1.jquery的js文件 2.jquery.upload ...

  8. java使用array.copy复制数组

    总结:理解理解.重要啊 package com.a; import java.util.Arrays; public class FJKDLS { public static void main(St ...

  9. 求n对括号的合法组合

    一道经典的面试题,求n对括号有多少种合法的组合. 抽象为2n个位置,每个位置可以有2种取值,总共有2^2n个组合,附加约束条件是要符合括号的语法,用来剪枝. 括号语法的合法性条件: 初始化左括号和右括 ...

  10. VMware虚拟机上网络连接模式bridged(桥接模式)

    VMware虚拟机上网络连接模式bridged(桥接模式)的实质就是虚拟机本身利用主机的网卡对外直接作为一个真实的物理主机存在. 也就是理论上此时的虚拟机和主机没什么关系,只是和主机公用了一块网卡,其 ...