jqGrid warning please select row position

前端 未结 3 1367
挽巷
挽巷 2021-01-17 00:24

is there a way to positioning the dialog message \"Please select row\" in the corner left top of the selected grid?

I just want the same behavior in alert warning, j

相关标签:
3条回答
  • 2021-01-17 01:01

    As I wrote upper in a comment I have a long table and I need alert window always to be at the center of viewport. So I need dynamic positioning of the alert window. I need to set position after user scroll page down and click "edit" or "delete".

    As I understand Nav does not have events like "beforeShowForm" or "beforeShowSearch" for the alert modal window. Also I can't catch clicks on the pager.

    Solution provided by Oleg and Paulo Pinto does not work for me. I don't know why. I even don't understand how it works :)

    So I found my own straight and ... not nice way.

    loadComplete: function(){
        $(window).scroll(function() {
            $('#alert_window_id').center();
        });
    }
    

    where "center()" is

    jQuery.fn.center = function () {
        this.css("position","absolute");
        this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
        this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
        return this;
    }
    

    After loadComplete the alert div seems already exist and grid has its full height so window scroll exists too. Because I have no events of clicking "edit" button or alert dialog shown - i am repositioning alert dialog after every scroll event.

    0 讨论(0)
  • 2021-01-17 01:04

    look at this answer

    http://www.ok-soft-gmbh.com/jqGrid/CenterEditForm.htm

    you need to change your beforeShowForm event

    or you can implement this function on afterShowform event

    function centerForm ($form) {
                        $form.closest('div.ui-jqdialog').position({
                            my: "center",
                            of: $('#grid').closest('div.ui-jqgrid')
                        });
                        }
    

    0 讨论(0)
  • 2021-01-17 01:24

    If I understand correct your question you can use alerttop and alertleft options of navGrid. The parameters could be included in parameters option of navGrid. The answer describes one more non-documented options of navGrid.

    0 讨论(0)
提交回复
热议问题