easy ui 1.4的NumberBox,失去焦点后不能再次输入小数点
这也是1.4版本的bug,现在1.4.1也发布了,经验证,该问题在新版本中已经解决了
在网上找到的解决办法,地址:http://www.jeasyui.com/forum/index.php?topic=3659.msg8388
在easy ui的js里,添加下面的js代码:
- /**
- * The Patch for jQuery EasyUI 1.4
- */
- (function($){
- var plugin = $.fn._size;
- $.fn._size = function(options, parent){
- if (typeof options != 'string'){
- return this.each(function(){
- parent = parent || $(this).parent();
- if (parent.length){
- plugin.call($(this), options, parent);
- }
- });
- } else if (options == 'unfit'){
- return this.each(function(){
- var p = $(this).parent();
- if (p.length){
- plugin.call($(this), options, parent);
- }
- });
- } else {
- return plugin.call(this, options, parent);
- }
- }
- })(jQuery);
- (function($){
- $.map(['validatebox','textbox','filebox','searchbox',
- 'combo','combobox','combogrid','combotree',
- 'datebox','datetimebox','numberbox',
- 'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){
- if ($.fn[plugin]){
- if ($.fn[plugin].defaults.events){
- $.fn[plugin].defaults.events.click = function(e){
- if (!$(e.data.target).is(':focus')){
- $(e.data.target).trigger('focus');
- }
- };
- }
- }
- });
- $.fn.combogrid.defaults.height = 22;
- $(function(){
- $(document).bind('mousewheel', function(e){
- $(e.target).trigger('mousedown.combo');
- });
- });
- })(jQuery);
- (function($){
- function setMe(target){
- var state = $.data(target, 'textbox');
- var opts = state.options;
- state.textbox.find('.textbox-addon .textbox-icon').each(function(index){
- $(this).attr('tabindex', '-1');
- });
- $(target).textbox('textbox').unbind('focus.textbox').bind('focus.textbox', function(e){
- var tb = $(target).next();
- if (tb.hasClass('textbox-focused')){return;}
- if ($(this).val() != opts.value){
- $(this).val(opts.value);
- }
- $(this).removeClass('textbox-prompt');
- tb.addClass('textbox-focused');
- });
- }
- var plugin = $.fn.textbox;
- $.fn.textbox = function(options, param){
- if (typeof options != 'string'){
- return this.each(function(){
- plugin.call($(this), options, param);
- setMe(this);
- });
- } else {
- return plugin.call(this, options, param);
- }
- };
- $.fn.textbox.methods = plugin.methods;
- $.fn.textbox.defaults = plugin.defaults;
- $.fn.textbox.parseOptions = plugin.parseOptions;
- })(jQuery);
- (function($){
- function setMe(target){
- var addon = $(target).next().find('.textbox-addon');
- addon.find('.spinner-arrow-up,.spinner-arrow-down').attr('tabindex','-1');
- }
- var plugin = $.fn.spinner;
- $.fn.spinner = function(options, param){
- if (typeof options != 'string'){
- return this.each(function(){
- plugin.call($(this), options, param);
- setMe(this);
- });
- } else {
- return plugin.call(this, options, param);
- }
- };
- $.fn.spinner.methods = plugin.methods;
- $.fn.spinner.defaults = plugin.defaults;
- $.fn.spinner.parseOptions = plugin.parseOptions;
- })(jQuery);
- (function($){
- $.extend($.fn.form.methods, {
- clear: function(jq){
- return jq.each(function(){
- var target = this;
- $('input,select,textarea', target).each(function(){
- var t = this.type, tag = this.tagName.toLowerCase();
- if (t == 'text' || t == 'hidden' || t == 'password' || tag == 'textarea'){
- this.value = '';
- } else if (t == 'file'){
- var file = $(this);
- if (!file.hasClass('textbox-value')){
- var newfile = file.clone().val('');
- newfile.insertAfter(file);
- if (file.data('validatebox')){
- file.validatebox('destroy');
- newfile.validatebox();
- } else {
- file.remove();
- }
- }
- } else if (t == 'checkbox' || t == 'radio'){
- this.checked = false;
- } else if (tag == 'select'){
- this.selectedIndex = -1;
- }
- });
- var t = $(target);
- var plugins = ['textbox','combo','combobox','combotree','combogrid','slider'];
- for(var i=0; i<plugins.length; i++){
- var plugin = plugins[i];
- var r = t.find('.'+plugin+'-f');
- if (r.length && r[plugin]){
- r[plugin]('clear');
- }
- }
- $(target).form('validate');
- });
- }
- });
- $.extend($.fn.form.defaults, {
- onSubmit:function(){
- $(this).find('.textbox-text:focus').blur();
- return $(this).form('validate');
- }
- });
- })(jQuery);
- (function($){
- function setSize(target, param){
- var opts = $.data(target, 'linkbutton').options;
- if (param){
- $.extend(opts, param);
- }
- if (opts.width || opts.height || opts.fit){
- var btn = $(target);
- var parent = btn.parent();
- var isVisible = btn.is(':visible');
- if (!isVisible){
- var spacer = $('<div style="display:none"></div>').insertBefore(target);
- var style = {
- position: btn.css('position'),
- display: btn.css('display'),
- left: btn.css('left')
- };
- btn.appendTo('body');
- btn.css({
- position:'absolute',
- display:'inline-block',
- left:-20000
- });
- }
- btn._size(opts, parent);
- var left = btn.find('.l-btn-left');
- left.css('margin-top', 0);
- left.css('margin-top', parseInt((btn.height()-left.height())/2)+'px');
- if (!isVisible){
- btn.insertAfter(spacer);
- btn.css(style);
- spacer.remove();
- }
- }
- }
- var plugin = $.fn.linkbutton;
- $.fn.linkbutton = function(options, param){
- if (typeof options != 'string'){
- return this.each(function(){
- plugin.call($(this), options, param);
- setSize(this);
- });
- } else {
- return plugin.call(this, options, param);
- }
- };
- $.fn.linkbutton.methods = plugin.methods;
- $.fn.linkbutton.defaults = plugin.defaults;
- $.fn.linkbutton.parseOptions = plugin.parseOptions;
- $.extend($.fn.linkbutton.methods, {
- resize: function(jq, param){
- return jq.each(function(){
- setSize(this, param);
- })
- }
- })
- })(jQuery);
- (function($){
- var plugin = $.fn.dialog;
- $.fn.dialog = function(options, param){
- var result = plugin.call(this, options, param);
- if (typeof options != 'string'){
- this.each(function(){
- var opts = $(this).panel('options');
- if (isNaN(parseInt(opts.height))){
- $(this).css('height', '');
- }
- var onResize = opts.onResize;
- opts.onResize = function(w, h){
- onResize.call(this, w, h);
- if (isNaN(parseInt(opts.height))){
- $(this).css('height', '');
- }
- var shadow = $.data(this, 'window').shadow;
- if (shadow){
- var cc = $(this).panel('panel');
- shadow.css({
- width: cc._outerWidth(),
- height: cc._outerHeight()
- });
- }
- }
- if (opts.closed){
- var pp = $(this).panel('panel');
- pp.show();
- $(this).panel('resize');
- pp.hide();
- }
- });
- }
- return result;
- };
- $.fn.dialog.methods = plugin.methods;
- $.fn.dialog.parseOptions = plugin.parseOptions;
- $.fn.dialog.defaults = plugin.defaults;
- })(jQuery);
- (function($){
- function createTab(container, pp, options) {
- var state = $.data(container, 'tabs');
- options = options || {};
- // create panel
- pp.panel({
- border: false,
- noheader: true,
- closed: true,
- doSize: false,
- iconCls: (options.icon ? options.icon : undefined)
- });
- var opts = pp.panel('options');
- $.extend(opts, options, {
- onLoad: function(){
- if (options.onLoad){
- options.onLoad.call(this, arguments);
- }
- state.options.onLoad.call(container, $(this));
- }
- });
- var tabs = $(container).children('div.tabs-header').find('ul.tabs');
- opts.tab = $('<li></li>').appendTo(tabs); // set the tab object in panel options
- opts.tab.append(
- '<a href="javascript:void(0)" class="tabs-inner">' +
- '<span class="tabs-title"></span>' +
- '<span class="tabs-icon"></span>' +
- '</a>'
- );
- $(container).tabs('update', {
- tab: pp,
- options: opts
- });
- }
- function addTab(container, options) {
- var opts = $.data(container, 'tabs').options;
- var tabs = $.data(container, 'tabs').tabs;
- if (options.selected == undefined) options.selected = true;
- var pp = $('<div></div>').appendTo($(container).children('div.tabs-panels'));
- tabs.push(pp);
- createTab(container, pp, options);
- opts.onAdd.call(container, options.title, tabs.length-1);
- $(container).tabs('resize');
- if (options.selected){
- $(container).tabs('select', tabs.length-1);
- }
- }
- $.extend($.fn.tabs.methods, {
- add: function(jq, options){
- return jq.each(function(){
- addTab(this, options);
- })
- }
- })
- })(jQuery);
- (function($){
- $.extend($.fn.menubutton.methods, {
- enable: function(jq){
- return jq.each(function(){
- $(this).data('menubutton').options.disabled = false;
- $(this).linkbutton('enable');
- });
- }
- });
- })(jQuery);
- (function($){
- var onAfterRender = $.fn.datagrid.defaults.view.onAfterRender;
- $.extend($.fn.datagrid.defaults.view, {
- updateRow: function(target, rowIndex, row){
- var opts = $.data(target, 'datagrid').options;
- var rows = $(target).datagrid('getRows');
- var oldStyle = _getRowStyle(rowIndex);
- $.extend(rows[rowIndex], row);
- var newStyle = _getRowStyle(rowIndex);
- var oldClassValue = oldStyle.c;
- var styleValue = newStyle.s;
- var classValue = 'datagrid-row ' + (rowIndex % 2 && opts.striped ? 'datagrid-row-alt ' : ' ') + newStyle.c;
- function _getRowStyle(rowIndex){
- var css = opts.rowStyler ? opts.rowStyler.call(target, rowIndex, rows[rowIndex]) : '';
- var classValue = '';
- var styleValue = '';
- if (typeof css == 'string'){
- styleValue = css;
- } else if (css){
- classValue = css['class'] || '';
- styleValue = css['style'] || '';
- }
- return {c:classValue, s:styleValue};
- }
- function _update(frozen){
- var fields = $(target).datagrid('getColumnFields', frozen);
- var tr = opts.finder.getTr(target, rowIndex, 'body', (frozen?1:2));
- var checked = tr.find('div.datagrid-cell-check input[type=checkbox]').is(':checked');
- tr.html(this.renderRow.call(this, target, fields, frozen, rowIndex, rows[rowIndex]));
- tr.attr('style', styleValue).removeClass(oldClassValue).addClass(classValue);
- if (checked){
- tr.find('div.datagrid-cell-check input[type=checkbox]')._propAttr('checked', true);
- }
- }
- _update.call(this, true);
- _update.call(this, false);
- $(target).datagrid('fixRowHeight', rowIndex);
- },
- onAfterRender: function(target){
- onAfterRender.call($.fn.datagrid.defaults.view, target);
- setTimeout(function(){
- var opts = $(target).datagrid('options');
- opts.pageNumber = opts.pageNumber || 1;
- },0);
- }
- });
- $.fn.datagrid.defaults.loader = function(param, success, error){
- var opts = $(this).datagrid('options');
- if (!opts.url) return false;
- if (opts.pagination && opts.pageNumber == 0){
- opts.pageNumber = 1;
- param.page = 1;
- }
- if (param.page == 0){
- return false;
- }
- $.ajax({
- type: opts.method,
- url: opts.url,
- data: param,
- dataType: 'json',
- success: function(data){
- success(data);
- },
- error: function(){
- error.apply(this, arguments);
- }
- });
- };
- })(jQuery);
- (function($){
- function indexOfArray(a,o){
- for(var i=0,len=a.length; i<len; i++){
- if (a[i] == o) return i;
- }
- return -1;
- }
- function endEdit(target, index){
- var state = $.data(target, 'datagrid');
- var opts = state.options;
- var updatedRows = state.updatedRows;
- var insertedRows = state.insertedRows;
- var tr = opts.finder.getTr(target, index);
- var row = opts.finder.getRow(target, index);
- if (!tr.hasClass('datagrid-row-editing')) {
- return;
- }
- if (!$(target).datagrid('validateRow', index)){return}
- var changed = false;
- var changes = {};
- tr.find('div.datagrid-editable').each(function(){
- var field = $(this).parent().attr('field');
- var ed = $.data(this, 'datagrid.editor');
- var t = $(ed.target);
- var input = t.data('textbox') ? t.textbox('textbox') : t;
- input.triggerHandler('blur');
- var value = ed.actions.getValue(ed.target);
- if (row[field] != value){
- row[field] = value;
- changed = true;
- changes[field] = value;
- }
- });
- if (changed){
- if (indexOfArray(insertedRows, row) == -1){
- if (indexOfArray(updatedRows, row) == -1){
- updatedRows.push(row);
- }
- }
- }
- opts.onEndEdit.call(target, index, row, changes);
- tr.removeClass('datagrid-row-editing');
- destroyEditor(target, index);
- $(target).datagrid('refreshRow', index);
- opts.onAfterEdit.call(target, index, row, changes);
- }
- function destroyEditor(target, index){
- var opts = $.data(target, 'datagrid').options;
- var tr = opts.finder.getTr(target, index);
- tr.children('td').each(function(){
- var cell = $(this).find('div.datagrid-editable');
- if (cell.length){
- var ed = $.data(cell[0], 'datagrid.editor');
- if (ed.actions.destroy) {
- ed.actions.destroy(ed.target);
- }
- cell.html(ed.oldHtml);
- $.removeData(cell[0], 'datagrid.editor');
- cell.removeClass('datagrid-editable');
- cell.css('width','');
- }
- });
- }
- $.extend($.fn.datagrid.methods, {
- endEdit: function(jq, index){
- return jq.each(function(){
- endEdit(this, index);
- })
- }
- })
- })(jQuery);
- (function($){
- function setGrid(target){
- var opts = $.data(target, 'propertygrid').options;
- $(target).datagrid('options').onBeforeEdit = function(index, row){
- if (opts.onBeforeEdit.call(target, index, row) == false){return false;}
- var dg = $(this);
- var col = dg.datagrid('getColumnOption', 'value');
- col.editor = row.editor;
- }
- }
- var plugin = $.fn.propertygrid;
- $.fn.propertygrid = function(options, param){
- if (typeof options == 'string'){
- return plugin.call(this, options, param);
- } else {
- return this.each(function(){
- plugin.call($(this), options, param);
- setGrid(this);
- });
- }
- };
- $.fn.propertygrid.defaults = plugin.defaults;
- $.fn.propertygrid.methods = plugin.methods;
- $.fn.propertygrid.parseOptions = plugin.parseOptions;
- })(jQuery);
- (function($){
- $.fn.numberbox.defaults.filter = function(e){
- var opts = $(this).numberbox('options');
- var s = $(this).numberbox('getText');
- if (e.which == 45){ //-
- return (s.indexOf('-') == -1 ? true : false);
- }
- var c = String.fromCharCode(e.which);
- if (c == opts.decimalSeparator){
- return (s.indexOf(c) == -1 ? true : false);
- } else if (c == opts.groupSeparator){
- return true;
- } else if ((e.which >= 48 && e.which <= 57 && e.ctrlKey == false && e.shiftKey == false) || e.which == 0 || e.which == 8) {
- return true;
- } else if (e.ctrlKey == true && (e.which == 99 || e.which == 118)) {
- return true;
- } else {
- return false;
- }
- }
- })(jQuery);
- (function($){
- var FILE_INDEX = 0;
- function buildFileBox(target){
- var state = $.data(target, 'filebox');
- var opts = state.options;
- var id = 'filebox_file_id_' + (++FILE_INDEX);
- $(target).addClass('filebox-f').textbox($.extend({}, opts, {
- buttonText: opts.buttonText ? ('<label for="' + id + '">' + opts.buttonText + '</label>') : ''
- }));
- $(target).textbox('textbox').attr('readonly','readonly');
- state.filebox = $(target).next().addClass('filebox');
- state.filebox.find('.textbox-value').remove();
- opts.oldValue = "";
- var file = $('<input type="file" class="textbox-value">').appendTo(state.filebox);
- file.attr('id', id).attr('name', $(target).attr('textboxName')||'');
- file.css('visibility', 'visible');
- file.change(function(){
- $(target).filebox('setText', this.value);
- opts.onChange.call(target, this.value, opts.oldValue);
- opts.oldValue = this.value;
- });
- var btn = $(target).filebox('button');
- if (btn.length){
- if (btn.linkbutton('options').disabled){
- file.attr('disabled', 'disabled');
- } else {
- file.removeAttr('disabled');
- }
- }
- }
- var plugin = $.fn.filebox;
- $.fn.filebox = function(options, param){
- if (typeof options != 'string'){
- return this.each(function(){
- plugin.call($(this), options, param);
- buildFileBox(this);
- });
- } else {
- return plugin.call(this, options, param);
- }
- };
- $.fn.filebox.methods = plugin.methods;
- $.fn.filebox.defaults = plugin.defaults;
- $.fn.filebox.parseOptions = plugin.parseOptions;
- })(jQuery);
- (function($){
- function forNodes(data, callback){
- var nodes = [];
- for(var i=0; i<data.length; i++){
- nodes.push(data[i]);
- }
- while(nodes.length){
- var node = nodes.shift();
- if (callback(node) == false){return;}
- if (node.children){
- for(var i=node.children.length-1; i>=0; i--){
- nodes.unshift(node.children[i]);
- }
- }
- }
- }
- function findNodeBy(target, param, value){
- var data = $.data(target, 'tree').data;
- var result = null;
- forNodes(data, function(node){
- if (node[param] == value){
- result = attachProperties(node);
- return false;
- }
- });
- return result;
- }
- function getNode(target, nodeEl){
- return findNodeBy(target, 'domId', $(nodeEl).attr('id'));
- }
- function attachProperties(node){
- var d = $('#'+node.domId);
- node.target = d[0];
- node.checked = d.find('.tree-checkbox').hasClass('tree-checkbox1');
- return node;
- }
- $.fn.tree.methods.getChildren = function(jq, nodeEl){
- var target = jq[0];
- var nodes = [];
- var n = getNode(target, nodeEl);
- var data = n ? (n.children||[]) : $.data(target, 'tree').data;
- forNodes(data, function(node){
- nodes.push(attachProperties(node));
- });
- return nodes;
- }
- })(jQuery);
easy ui 1.4的NumberBox,失去焦点后不能再次输入小数点的更多相关文章
- Easy UI分页控件修改刷新方法后触发两次请求
今天我在做分页的时候,有这样的一个现象: 我重写了分页的刷新和改变页面大小的方法,发现给服务器提交了两次post,问题出现在哪里的?经过alert调试,发现原因是: 刷新和改变页面大小的事件执行的时候 ...
- JQuery Easy Ui dataGrid 数据表格 ---制作查询下拉菜单
JQuery Easy Ui dataGrid 数据表格 数据表格 - DataGrid 继承$.fn.panel.defaults,使用$.fn.datagrid.defaults重载默认值.. 数 ...
- JQuery Easy Ui (Tree树)详解(转)
第一讲:JQuery Easy Ui到底是什么呢? 首先咱们知道JQuery是对Java Script的封装,是一个js库,主要提供的功能是选择器,属性修改和事件绑定等等.. JQuery ui是在j ...
- 茗洋Easy UI 1.3.5 部分问题解决系列专题[自定义alert关闭时间,自动关]
[评论,楼层数为30的倍数的,我送你我自己的博客园的皮肤,该博客参与活动] 这次我又给大家带来的EasyUI的我研究拓展的新特性 我使用的是 EasyUI 1.3.5版本的,项目是ASP.NET M ...
- 让Easy UI 的DataGrid直接内嵌的JSON对象,并重写form load 方法
前言 我有这样的JSON对象 { "UserName": "jf", "UserPwd": "123456", &quo ...
- Struts2 easy UI插件
一.easy UI是类似于jQuery UI的插件库,它提供了丰富的各种常用插件:tree.datagrid... tree插件: 语法:$(selector).tree([settings]); 常 ...
- Easy UI常用插件使用
一.easy UI是类似于jQuery UI的插件库,它提供了丰富的各种常用插件:tree.datagrid... tree插件: 语法:$(selector).tree([settings]); 常 ...
- easy ui插件
简介: easy UI是类似于jQuery UI的插件库 注意:多脚本同时使用时,注意脚本冲突问题. 常用插件: 1.tree插件(tree插件实现动态树形菜单) 2.datagrid插件(datag ...
- easy ui 框架
Easy UI 准备工作(搭建) 1.在WebRoot 的目录下创建js 文件夹,在文件夹中倒入一下两个包 Jquery.easyui.min.js jquery.min.js 2.在WebRoot ...
随机推荐
- 富客户端 wpf, Winform 多线程更新UI控件
前言 在富客户端的app中,如果在主线程中运行一些长时间的任务,那么应用程序的UI就不能正常相应.因为主线程要负责消息循环,相应鼠标等事件还有展现UI. 因此我们可以开启一个线程来格外处理需要长时间的 ...
- 阿里巴巴开源技术 WebX
0. WebX项目目前已开源, 项目开源地址:https://github.com/webx/citrus-sample.git 项目参考文档:http://www.openwebx.org/docs ...
- 高级Java研发工程师面试题总结
目录 一.Java基础 二.JVM虚拟机基础 三.开源框架基础 四.分布式基础 五.设计模式基础 六.数据库基础 七.网络基础 八.数据结构和算法基础 九.Linux基础 十.其他技术基础 一.JAV ...
- 说说IT技术团队招聘那点事
因为近来由于新项目的需要,各种招聘比较多,几乎每周都要面试几个人,顺便对以前的面试和带开发经验进行简单的总结 1.首先负责招聘的人一定得是自己团队的人,而且在招聘的时候一定要想清楚目标候选人进来的职责 ...
- json 对象 数组
一.json写法以及获得其数据的方法 var jsons={ name:'wen', age:12, price:'qq' } console.log(typeof jsons);//object c ...
- C#如何在钉钉开发平台中创建部门
钉钉是阿里巴巴专为中小企业和团队打造的沟通.协同的多端平台,钉钉开放平台旨在为企业提供更为丰富的办公协同解决方案.通过钉钉开放平台,企业或第三方合作伙伴可以帮助企业快速.低成本的实现高质量的移动微应用 ...
- Cool!15个创意的 CSS3 文本效果【下篇】
这里文章收集了15个创意的 CSS3 文本效果,所有的都是精心挑选,这些可能会增加创意的火花到你的下一个项目.其中有些是用于特定用途,而另一些则适用于多种用途.如果你想要一个精彩而又充满色彩的文字效果 ...
- 【MVC学习笔记01】初窥奥秘
前言 最近工作落实了,是我非常喜欢的无线前端,会接触很多新东西啦,需要努力才行.因为会用到backbone,所以要学习MVC啦. MVC(模型-视图-控制器),这种模式最早被用于构建桌面程序和服务器端 ...
- Sublime Text 3汉化中文版
Sublime Text 3汉化中文版是Sublime Text2的升级版.Sublime Text 是一款流行的文本编辑器软件,有点类似于TextMate,跨平台,可运行在Linux,Windows ...
- 在线代码编辑器CodeMirror简介
1.什么是Code Mirror 最近做一个项目需要在网页上实现一个代码编辑器,支持语法高亮.自动缩进.智能提示等功能.发现Code Mirror刚好满足所有需求.Code Mirror是由js写的一 ...