easyui grid 里的可编辑text 加清空图标
$.extend($.fn.datagrid.defaults.editors, {
text: {
init: function (container, options) {
var _opt = $('<input type="text" class="datagrid-editable-input">');
var curField = container.prevObject.prevObject.attr('field');
if (curField == "我们需要加清空的字段" ) {
var button = $('<input type="text" class="easyui-textbox"> ').appendTo(container);
button.textbox({
//添加清除图标
icons: [{
iconCls: 'icon-clear',
handler: function (e) {
button.textbox('clear');
//modelTextClear 是自定义清除 grid 里数据 的函数
modelTextClear(curField);
}
}]
});
if (typeof (options.onClick) == 'function') {
var el = button.next().children('.textbox-text');
el.click(function () {
options.onClick(el);
});
}
return button;
}
if (typeof (options.onChange) == 'function') {
_opt.change(function () {
options.onChange(_opt);
});
}
if (typeof (options.onFocus) == 'function') {
_opt.focus(function () {
options.onFocus(_opt);
});
}
if (typeof (options.onKeyup) == 'function') {
_opt.keyup(function () {
options.onKeyup(_opt);
});
}
var input = _opt.appendTo(container);
if (container.closest('td[field]').attr('field') == 'ApplyDate') {
_opt.addClass('form-control');
return input.datetimepicker({
minView: "month", //选择日期后,不会再跳转去选择时分秒
format: "yyyy-mm-dd", //选择日期后,文本框显示的日期格式
language: 'zh-CN', //汉化
autoclose: true
});
}else {
return input;
}
},
destroy: function (target) {
$(target).remove();
},
getValue: function (target) {
return $(target).val();
},
setValue: function (target, value) {
$(target).val(value);
},
resize: function (target, width) {
$(target)._outerWidth(width);
//以下是处理图标不显示的问题 因为span 占满了单元格
var curField = target.closest('[field]').attr('field');
if (curField == "ReimbursementID" || curField == "CostCenterDisplayName" || curField == "ProductDisplayName") {
target.next('.textbox').css('width', width);
target.next().children('.textbox-text').css('width', width - 26);
}
}
}
});
easyui grid 里的可编辑text 加清空图标的更多相关文章
- easy-ui grid里的toobar按钮隐藏与显示
//隐藏第一个按钮$('div.datagrid-toolbar a').eq(0).hide();//隐藏第一条分隔线$('div.datagrid-toolbar div').eq(0).hide ...
- ligerui_实际项目_003:form中添加数据,表格(grid)里面显示,最后将表格(grid)里的数据提交到servlet
实现效果: "Form"中填写数据,向本页"Grid"中添加数据,转换成Json数据提交,计算总和,Grid文本框可编辑,排序 图片效果: 总结: //disp ...
- easyui grid 增加合计行
一.首先,easyui grid 的 showfooter 属性设置为 true $aplgrid.datagrid({ data: globalExpenseClaimForm.ExpenseCl ...
- 问题-[Delphi]在对GRID设置单击为编辑时,其他GRID可以,但有一个GRID不行?
问题现象:在对GRID设置单击为编辑时,其他GRID可以,但有一个GRID不行?问题原因:在这个GRID中的单击事件可能不存在,可以测试一下有没有单击事件.解决方法:需要在GRID的上一个类中,放开单 ...
- jQuery EasyUI动态添加控件或者ajax加载页面后不能自动渲染问题的解决方法
博客分类: jquery-easyui jQueryAjax框架HTML 现象: AJAX返回的html无法做到自动渲染为EasyUI的样式.比如:class="easyui-layout ...
- easyui datagrid里的复选框置灰方法
easyui datagrid里的复选框置灰方法: $('.datagrid input').prop('disabled',true);//复选框置灰
- EasyUI datagrid 明细表格中编辑框 事件绑定 及灵活计算 可根据此思路 扩展其他
原创 : EasyUI datagrid 明细表格中编辑框 事件绑定 及灵活计算 可根据此思路 扩展其他 转载,请注明出处哦!谢谢! 原创 : EasyUI datagrid 明细表格中编辑框 事件绑 ...
- easyui grid 本地做分页
背景: 有的数据不是很多,但是有分页的需求,这个时候后台往往没有做分页,我们是一次请求了所有的数据. 代码: dataSource 为 grid 里的数据源 html部分: <table id= ...
- ExtJs 日期相加,Grid表格列可编辑
1.日期相加: Ext.Date.add(new Date(), Ext.Date.DAY, 15) 2.Grid表格列可编辑: { header : "实际已交货量", ...
随机推荐
- weex 初始化
文档教程 一. 已有项目集成weex, 有时候会报错, 因为sdk中用到了socket pod 'WeexSDK' pod 'SocketRocket' 二. 在app启动方法 -didFinish ...
- apt 命令大全
#1. 搜索包 sudo apt-cache search package #2.获取包的相关信息,如说明,大小,版本. sudo apt-cache show package #3.了解包的依赖 s ...
- 二分--POJ-3258
POJ-3258,二分 题目 Description Every year the cows hold an event featuring a peculiar version of hopscot ...
- UML-4-初始不是需求阶段
1.初始阶段到底做什么? 确定项目外包还是自研.成本多少. 系统边界 关键的10%的用例.非功能性需求分析,业务案例创建 开发环境准备 而需求分析是在细化阶段进行的. 2.初始阶段(或细化阶段早期)应 ...
- oracle表空间tablespace
用户:用户是在实例下建立的.不同实例可以建相同名字的用户. 表空间:表空间是一个用来管理数据存储逻辑概念,表空间只是和数据文件(ORA或者DBF文件)发生关系,数据文件是物理的,一个表空间可以包含多个 ...
- 2019.03.29 读书笔记 关于params与可选参数
void Method1(string str, object a){} void Method2(string str, object a,object b) { } void Method3(st ...
- 关于null的操作
空值 空值一般用NULL表示 一般表示未知的.不确定的值,也不是空格 一般运算符与其进行运算时,都会为空 空不与任何值相等 表示某个列为空用:IS NULL 不能使用COMM=NULL这种形式 某个 ...
- centos 7编译安装mysql 5.7.17
1.进入MySQL官网下载MySQL源代码 依次点击Downloads -> Community -> MySQL Community Server 源代码1.Select Operati ...
- 利用C#结合net use命令破解域帐号密码
背景 我的职业是程序猿,而所在的工作单位因各种原因,对上网帐号有严格控制,近期竟然把我们的上网帐号全部停用,作为程序猿,不能上网,就如同鱼儿没有水,煮饭没有米,必须想办法解决此问题.公司的局域网环境是 ...
- 【LESS系列】一些常用的Mixins
在我们平时的开发中,对于一些使用频率很高的方法函数,我们一般都会将其归纳到一起,整理出一个核心库来. 其实这个思想,借助 LESS 也可以在 CSS 中得以实现. 下面是几个在 W3CPLUS 中偷过 ...