jQueryUI effect and jqGrid

2019-01-27 02:27发布

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.

---- Update

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();
                }
            }
        });

1条回答
淡お忘
2楼-- · 2019-01-27 03:00

It's a good question!

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.

The demo for example uses the following code

$.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.

查看更多
登录 后发表回答