本文介绍了jQueryUI效果和jqGrid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用jQuery和jQueryUI构建的网站.所有对话框都使用相同的效果进行显示和隐藏.但是,我无法在jqGrid的editGridRow和viewGridRow方法创建的对话框上设置效果.我想知道是否有任何东西可以向jqGrid创建的对话框添加显示/隐藏效果.

I have a site built using jQuery and jQueryUI. All dialogs are using the same effects for showing and hiding. However I am unable to set effect on those dialogs created by editGridRow and viewGridRow methods of jqGrid. I wonder if there is anything to add showing/hiding effect to those dialogs created by jqGrid.

----更新

感谢奥列格(Oleg)处理jqGrid的技巧.我已经成功地更改了我的网站,以使对话框显示具有一致的效果.简而言之,我需要删除/更新对话框的内联样式,并且应该在效果之后创建tinymce.这是一些代码:

Thanks Oleg for his tricks in dealing with jqGrid. I have successfully changed my website to have a consistent effects on dialog showing. In short, I need to remove/update the inline style of the dialog and that tinymce ought to be created AFTER the effect. Here are some codes:

$(function () {
        var cssLeft;
        var cssTop;

        $.extend($.jgrid, {
            showModal: function (h) {
                if (cssLeft) {
                    h.w.css("left", cssLeft).css("top", cssTop);
                }
                h.w.show("fold", function() {
                    var htmlEditor = $("#item", h.w);
                    if (htmlEditor) {
                        htmlEditor.tinymce({
                            script_url: "/Scripts/tinymce.3.4.5/tiny_mce.js",
                            mode: "none",
                            theme: "advanced",
                            plugins: "autolink,lists,layer,advhr,advimage,advlink,emotions,inlinepopups,insertdatetime,media,searchreplace,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",
                            theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",
                            theme_advanced_buttons2: "cut,copy,paste,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,|,forecolor,backcolor",
                            theme_advanced_buttons3: "hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,media,advhr,|,fullscreen",
                            theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,blockquote,pagebreak,|,insertfile,insertimage",
                            theme_advanced_toolbar_location: "top",
                            theme_advanced_toolbar_align: "left",
                            theme_advanced_resizing: true,
                            theme_advanced_statusbar: false
                        });
                    }
                });
            },
            closeModal: function (h) {
                if (!cssLeft) {
                    cssLeft = h.w.css("left");
                    cssTop = h.w.css("top");
                }
                h.w.css("left", "inherit").css("top", "inherit");
                h.w.hide("blind").attr("aria-hidden", "true");
                var htmlEditor = $("#item", h.w);
                if (htmlEditor) {
                    if (htmlEditor.tinymce()) {
                        htmlEditor.tinymce().remove();
                    }
                }
                if (h.o) {
                    h.o.remove();
                }
            }
        });

推荐答案

这是一个好问题!

内部jqGrid使用 jqModal ,它将作为jqGrid的一部分(作为模块jqModal.js).要实现动画效果,您可以覆盖$.jgrid.showModal$.jgrid.closeModal方法.

Internally jqGrid uses jqModal which will be as the part of jqGrid (as the module jqModal.js). To implement the animation effects you can overwrite the $.jgrid.showModal and $.jgrid.closeModal methods.

演示例如使用以下代码

$.extend($.jgrid, {
    showModal : function(h) {
        h.w.show("slow");
    },
    closeModal : function(h) {
        h.w.hide("slow").attr("aria-hidden", "true");
        if(h.o) {h.o.remove();}
    }
});

我认为您可以轻松地修改上述功能的代码,以实现与您在网站上使用的显示和隐藏效果相同的效果.

I think you can easy modify the code of above functions to implement the same effects for showing and hiding which you use on your site.

这篇关于jQueryUI效果和jqGrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 19:23