zoukankan      html  css  js  c++  java
  • 关于EasyUI 其他问题的解决方式先收藏,后续写demo

     combobox,绑定成功后选择第一项

    onLoadSuccess: function () {
    var data = $('#cbCity').combobox('getData');
    if (data.length > 0) {
    $('#cbCity').combobox('select', data[0].id);
    }
    }

    解决 easyui datagrid IE下合并单元格后行高变大

    添加datagrid属性:autoRowHeight:false  即可

    让隐藏的tab出现,大小显示正常

    $("#tabs").css("display","block").tabs('resize')

    EasyUI 中window dialog 组件窗体越界的处理办法

    在使用EasyUI窗体的时候会出现window拖动会越界的情况,发现EasyUI本身没有办法解决这个问题。就Search了下,找到了一个兄弟提供了自己的写的方法,解决这个问题。这里记录以下,提供给给需要帮助的使用。

    这里只贴解决代码,前因后果及bug修复,请访问原作者blog: http://www.easyui.info/archives/689.html

    var ie = (function() {   
        var undef, v = 3, div = document.createElement('div'), all = div   
                .getElementsByTagName('i');   
        while (div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->', all[0]);   
        return v > 4 ? v : undef;   
    }());   
    /**
     * add by cgh  
     * 针对panel window dialog三个组件调整大小时会超出父级元素的修正  
     * 如果父级元素的overflow属性为hidden,则修复上下左右个方向  
     * 如果父级元素的overflow属性为非hidden,则只修复上左两个方向  
     * @param width  
     * @param height  
     * @returns  
     */  
    var easyuiPanelOnResize = function(width, height) {   
        if (!$.data(this, 'window') && !$.data(this, 'dialog'))   
            return;   
      
        if (ie === 8) {   
            var data = $.data(this, "window") || $.data(this, "dialog");   
            if (data.pmask) {   
                var masks = data.window.nextAll('.window-proxy-mask');   
                if (masks.length > 1) {   
                    $(masks[1]).remove();   
                    masks[1] = null;   
                }   
            }   
        }   
        if ($(this).panel('options').maximized == true) {   
            $(this).panel('options').fit = false;   
        }   
        $(this).panel('options').reSizing = true;   
        if (!$(this).panel('options').reSizeNum) {   
            $(this).panel('options').reSizeNum = 1;   
        } else {   
            $(this).panel('options').reSizeNum++;   
        }   
        var parentObj = $(this).panel('panel').parent();   
        var left = $(this).panel('panel').position().left;   
        var top = $(this).panel('panel').position().top;   
      
        if ($(this).panel('panel').offset().left < 0) {   
            $(this).panel('move', {   
                        left : 0   
                    });   
        }   
        if ($(this).panel('panel').offset().top < 0) {   
            $(this).panel('move', {   
                        top : 0   
                    });   
        }   
      
        if (left < 0) {   
            $(this).panel('move', {   
                        left : 0   
                    }).panel('resize', {   
                        width : width + left   
                    });   
        }   
        if (top < 0) {   
            $(this).panel('move', {   
                        top : 0   
                    }).panel('resize', {   
                        height : height + top   
                    });   
        }   
        if (parentObj.css("overflow") == "hidden") {   
            var inline = $.data(this, "window").options.inline;   
            if (inline == false) {   
                parentObj = $(window);   
            }   
      
            if ((width + left > parentObj.width())   
                    && $(this).panel('options').reSizeNum > 1) {   
                $(this).panel('resize', {   
                            width : parentObj.width() - left   
                        });   
            }   
      
            if ((height + top > parentObj.height())   
                    && $(this).panel('options').reSizeNum > 1) {   
                $(this).panel('resize', {   
                            height : parentObj.height() - top   
                        });   
            }   
        }   
        $(this).panel('options').reSizing = false;   
    };   
    /**
     * add by cgh  
     * 针对panel window dialog三个组件拖动时会超出父级元素的修正  
     * 如果父级元素的overflow属性为hidden,则修复上下左右个方向  
     * 如果父级元素的overflow属性为非hidden,则只修复上左两个方向  
     * @param left  
     * @param top  
     * @returns  
     */  
    var easyuiPanelOnMove = function(left, top) {   
        if ($(this).panel('options').reSizing)   
            return;   
        var parentObj = $(this).panel('panel').parent();   
        var width = $(this).panel('options').width;   
        var height = $(this).panel('options').height;   
        var right = left + width;   
        var buttom = top + height;   
        var parentWidth = parentObj.width();   
        var parentHeight = parentObj.height();   
      
        if (left < 0) {   
            $(this).panel('move', {   
                        left : 0   
                    });   
        }   
        if (top < 0) {   
            $(this).panel('move', {   
                        top : 0   
                    });   
        }   
      
        if (parentObj.css("overflow") == "hidden") {   
            var inline = $.data(this, "window").options.inline;   
            if (inline == false) {   
                parentObj = $(window);   
            }   
            if (left > parentObj.width() - width) {   
                $(this).panel('move', {   
                            "left" : parentObj.width() - width   
                        });   
            }   
            if (top > parentObj.height() - height) {   
                $(this).panel('move', {   
                            "top" : parentObj.height() - height   
                        });   
            }   
        }   
    };   
      
    $.fn.window.defaults.onResize = easyuiPanelOnResize;   
    $.fn.dialog.defaults.onResize = easyuiPanelOnResize;   
    $.fn.window.defaults.onMove = easyuiPanelOnMove;   
    $.fn.dialog.defaults.onMove = easyuiPanelOnMove;
  • 相关阅读:
    C#中Invoke的用法(转)
    C#中Thread.IsBackground 属性
    127.0.0.1是什么地址?
    C# Socket服务器端如何判断客户端断开求解
    C#中线程间操作无效: 从不是创建控件 txtBOX 的线程访问它。
    C#多线程学习之如何操纵一个线程
    利用TCP协议,实现基于Socket的小聊天程序(初级版)
    进程与线程的一个简单解释
    javascript修改css样式表
    html根据下拉框选中的值修改背景颜色
  • 原文地址:https://www.cnblogs.com/AaronYang/p/3088620.html
Copyright © 2011-2022 走看看