zoukankan      html  css  js  c++  java
  • jQuery扩展easyui.datagrid,添加数据loading遮罩效果代码

            //jquery.datagrid 扩展加载数据Loading效果
            (function (){
                $.extend($.fn.datagrid.methods, {
                    //显示遮罩
                    loading: function(jq){
                        return jq.each(function(){
                            $(this).datagrid("getPager").pagination("loading");
                            var opts = $(this).datagrid("options");
                            var wrap = $.data(this,"datagrid").panel;
                            if(opts.loadMsg)
                            {
                                $("<div class="datagrid-mask"></div>").css({display:"block",wrap.width(),height:wrap.height()}).appendTo(wrap);
                                $("<div class="datagrid-mask-msg"></div>").html(opts.loadMsg).appendTo(wrap).css({display:"block",left:(wrap.width()-$("div.datagrid-mask-msg",wrap).outerWidth())/2,top:(wrap.height()-$("div.datagrid-mask-msg",wrap).outerHeight())/2});
                            }
                        });
                    },
                    //隐藏遮罩
                    loaded: function(jq){
                        return jq.each(function(){
                            $(this).datagrid("getPager").pagination("loaded");
                            var wrap = $.data(this,"datagrid").panel;
                            wrap.find("div.datagrid-mask-msg").remove();
                            wrap.find("div.datagrid-mask").remove();
                        });
                    }
                });
            })(jQuery);
    
    
    
            //使用方法:
            $("#dataGrid").datagrid("loadData",(function (){
                $("#dataGrid").datagrid("loading");
                return []; //[]需要加载的数据
            })());
    
    
            //在datagrid的事件onLoadSuccess中添加
            onLoadSuccess:function (){
                $("#dataGrid").datagrid("loaded");
            }



  • 相关阅读:
    PHP语言结构
    时钟拖放
    CSS定位
    vi命令(转)
    数值转化Excel列字母的函数
    SCOPE_IDENTITY、IDENT_CURRENT 和 @@IDENTITY的比较
    数字转化罗马数字的函数
    在VB中如何打开“文件夹选项”对话框?
    纯VB代码取得硬盘的物理序列号 (转)
    项目经理应该做什么
  • 原文地址:https://www.cnblogs.com/smartsmile/p/6234045.html
Copyright © 2011-2022 走看看