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 : "实际已交货量", ...
随机推荐
- Oracle PL/SQL学习之你需要知道的快捷键
1.格式化sql语句 Ctrl+A 然后 Ctrl+F7 2.窗口最大化最小化 首选项-->快捷键-->Maximize Toggle,然后修改成自己熟悉的快捷键设置.
- python学习,day3:示例,进度条
# coding=utf-8 # Author: RyAn Bi import sys,time for i in range(50): sys.stdout.write("#") ...
- 认识CSS中高级技巧之元素的显示与隐藏
前端之HTML,CSS(八) CSS高级技巧 元素的显示与隐藏 CSS中有三个属性可以设置元素的显示于隐藏,分别是:display.visibility和overflow. display 隐藏元素: ...
- archlinux安装tftp
1. 安装 [guo@archlinux ~]$ sudo pacman -S tftp-hpa 2. 启用 [guo@archlinux ~]$ systemctl start tftpd.se ...
- dotnetCore增加MiddleWare的Run,Use Map MapThen四个扩展方法
dotnetCore增加MiddleWare的Run,Use Map MapThen四个扩展方法 http://www.mamicode.com/info-detail-1439628.html
- 在浏览器中输入URL后,执行的全部过程。(一次完整的http请求过程)
整个流程如下: 域名解析 为了将消息从你的PC上传到服务器 上.需要用到1P协议.ARP协议和0SPF协议 发起TCP的3次握手 建立TCP连接后发起http请求 服务器响应htp请求 浏览器解析ht ...
- springboot利用fastjson序列化输出(默认是jackson)
在@SpringBootApplication类中添加 @Bean public HttpMessageConverters fastJsonHttpMessageConverters() { //创 ...
- IOS Intro - Write file
#import <sys/xattr.h> + (NSString *)getFullFilePathInDocuments:(NSString *)subFilePath fileNam ...
- (转)MySQL open_files_limit相关设置
http://www.cnblogs.com/zhoujinyi/archive/2013/01/31/2883433.html---------------------------MySQL ope ...
- WCF系列教程之初识WCF
本随笔参考自WCF编程系列(一)初识WCF,纯属读书笔记,加深记忆. 1.简介:Windows Communication Foundation(WCF)是微软为构建面向服务的应用程序所提供的统一编程 ...