Grid edit dialog placement

On longer grids the edit dialog does popup too low.

See http://jsplayground.syncfusion.com/30g5j5xn

In chrome this works correct, but firefox shows the dialog too low.

Also the grid is scrolled on showing the dialog. Is it possible to turn that behaviour off?

5 Replies

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team June 21, 2018 12:29 PM UTC

Hi Wouter, 

Thanks for contacting Syncfusion Support. 

Query #:- On longer grids the edit dialog does popup too low. Also the grid is scrolled on showing the dialog. Is it possible to turn that behaviour off? 
 
We can reproduce your reported problem at our end. When we use dialog Editing, the dialog box will get display on the center position of the Grid which is the default behavior in Grid.   

If you want to display the Dialog box in the same position where you have edit the row, we have achieved this scenario using actionComplete event of the Grid. In actionComplete event when we start editing, we have get the selected row target position as top and left and assign it position property of ejDialog. Thus you can open edit dialog from on the focused row to avoid scrolling.   
 
Please refer to the code example:- 

$(function () {  
        $("#Grid").ejGrid({  
            ...  
            actionComplete: "complete",  
                  
            columns: [  
...  
            ]  
        });  
  
    });  
    function complete(args) {  
        if ((args.requestType == "beginedit" || args.requestType == "add") && args.model.editSettings.editMode == "dialog") {  
            var row = this.model.selectedRowIndex;  
            var target = this.getRowByIndex(row);  
            var $target = $(target);  
            var docWidth = $(document).width(), dlgWidth = document.documentElement.clientWidth < 800 ? 200 : 250,  
                xPos = $target.position().left + 18,  
                yPos = $target.position().top + 2;  
            $("#" + this._id +"_dialogEdit").ejDialog({  //this._id is the ID of grid  
                title: args.requestType == "beginedit" ? "Edit" : "Add",  
                enableResize: true, //enable resize to dialog  
                position: { X: xPos, Y: yPos },  
            });  
        }  
    } 

Refer to the sample and API Link:- 


Please get back to us if you need any further assistance. 

Regards, 
Farveen sulthana T 




WO Wouter June 21, 2018 02:30 PM UTC

Thank you.

Your example does work, but my actual situation is not resolved. The grid still moves before the dialog is drawn. My grid does load data over ajax. That is the main difference.


FS Farveen Sulthana Thameeztheen Basha Syncfusion Team June 22, 2018 03:11 PM UTC

Hi  Wouter, 

To overcome your problem “Open the edit Dialog in the same position” we have changed the dialog position by getting its selected row class element "td.e-active' when args.requestType as beginEdit in the actionComplete event of the Grid.  
 
Please refer to the code example:- 
 
<script type="text/javascript"> 
        $(function () { 
            $("#Grid").ejGrid({ 
                // the datasource "window.gridData" is referred from jsondata.min.js 
                dataSource: window.gridData, 
                allowPaging: true, 
                actionComplete: "complete",                 
                   .   .   . 
           }); 
             
        }); 
    function complete(args) { 
        if ((args.requestType == "beginedit" || args.requestType == "add") && args.model.editSettings.editMode == "dialog") { 
            $("#Grid_dialogEdit").ejDialog({ 
                open: ej.proxy(function (args) { 
                    if (args.requestType == "beginedit") { 
                        var top = $('#Grid td.e-active').first().parent().offset().top - 200; 
                        if (top < 50) top = 100; 
                        $('#Grid_dialogEdit_wrapper').css('top', top); 
                        $('html, body').animate({ scrollTop: top }, 0); 
                    } 
                }, this, args) 
            }); 
 
        } 
    } 
         
    </script> 
 

Please refer to the sample Link:- 

After following the above solution still facing the issue, please share us the following details. 

1. Screenshot/Video Demo to replicate the issue. 
2.  Exact scenario you need to achieve. 

Regards, 

Farveen sulthana T 




WO Wouter June 26, 2018 09:46 AM UTC

I had some other element above the grid and I needed to substract that from the y position. My solution: http://jsplayground.syncfusion.com/lk22qgdn


FS Farveen Sulthana Thameeztheen Basha Syncfusion Team June 27, 2018 03:57 PM UTC

Hi Wouter, 

We have checked your sample and we have rendered other element above the Grid in the sample on previous update, the Dialog get displayed from the selected row as its target.  

Please refer to the modified sample:- 

Refer to the screenshot:- 
 

We need some additional information to find the cause of the issue. Please share us the following details 

1. Please confirm whether you need to display position of the dialog as like above demo Link or center of the element. 
2. Screenshot of your requirement. 

Regards 


Loader.
Up arrow icon