Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6391185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:38:29+00:00 2026-05-25T03:38:29+00:00

in My Jqgrid i have a column with delete links, everything works perfect, except

  • 0

in My Jqgrid i have a column with delete links, everything works perfect, except that delete confirmation box pops up at top left corner all the time. i want to have the confirmation box in center of the jqgrid, not in top left corner.

{ name: 'act', index: 'act', width: 150, align: 'center', sortable: false}],

          gridComplete: function () {

              var rows = jQuery("#list").jqGrid('getGridParam','selrow');
              var ids = jQuery("#list").jqGrid('getDataIDs');
              var gr = jQuery('#list'); gr.setGridHeight("auto", true);
              for (var i = 0; i < ids.length; i++) {
                  var cl = ids[i];
                  be = "<a href='#' style='height:25px;width:120px;' type='button' value='Slet' onclick=\"jQuery('#list').jqGrid('delGridRow','" + cl + "',{reloadAfterSubmit:false, url:'@Url.Action("deleteRow")'}); return false;\">Slet </>";
                  jQuery("#list").jqGrid('setRowData', ids[i], { act: be });   
              }
          },

UPDATE

be = "<a href='#' style='height:25px;width:120px;' type='button' value='Slet' onclick=\"jQuery('#list').jqGrid('delGridRow','" + cl + "', myDelParameters); return false;\">Slet </>";

code for my Global variable:

myDelParameters = {reloadAfterSubmit:false, url:'@Url.Action("deleteRow")',  beforeShowForm: function(form) {
              // "editmodlist"
      var dlgDiv = jQuery("#list").jqGrid("#delmodlist" + grid[0].id);
              var parentDiv = dlgDiv.parent(); // div#gbox_list
              var dlgWidth = dlgDiv.width();
              var parentWidth = parentDiv.width();
              var dlgHeight = dlgDiv.height();
              var parentHeight = parentDiv.height();
              // TODO: change parentWidth and parentHeight in case of the grid
              //       is larger as the browser window
              dlgDiv[0].style.top = Math.round((parentHeight-dlgHeight)/2) + "px";
              dlgDiv[0].style.left = Math.round((parentWidth-dlgWidth)/2) + "px";
          }};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:38:29+00:00Added an answer on May 25, 2026 at 3:38 am

    You set already some parameters of the delGridRow method (see {reloadAfterSubmit:false, url:... in your code).

    My suggestion that you use afterShowForm in the list of delGridRow parameters. The implementation of the afterShowForm could be like in the old answer, but with the usage of "#delmodlist" ("#delmod" + grid[0].id, where var grid = $("#list")) instead of $("#editmod" + grid[0].id).

    Another more short form of the implementation could be with respect of jQuery UI Position:

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

    In the demo I use such function for all Add/Edit and Delete forms.

    UPDATED: It seems to me that you have implementation problems. I made one more demo which you can easy modify to what you want. I don’t set any editurl, so if you press “Delete” button the error will be displayed. Moreover the HTML fragment which you try to place in the ‘act’ column is a combination of <a> and <button> settings. Because I don’t know what you wanted I placed just <a> in the ‘act’ column. I hope now you can easy modify my demo to make your program working.

    Here is the schema of the code from my demo which you can use:

    <script type="text/javascript">
    //<![CDATA[
        var myDelParameters = {
            reloadAfterSubmit: false,
            //url:'@Url.Action("deleteRow")',
            afterShowForm: function ($form) {
                'use strict';
                $form.closest('div.ui-jqdialog').position({
                    my: "center",
                    of: $("#list").closest('div.ui-jqgrid')
                });
            }
        };
        $(document).ready(function () {
            var grid = $("#list"),
                centerForm = function ($form) {
                    $form.closest('div.ui-jqdialog').position({
                        my: "center",
                        of: grid.closest('div.ui-jqgrid')
                    });
                },
                getColumnIndexByName = function (mygrid, columnName) {
                    var cm = mygrid.jqGrid('getGridParam', 'colModel'), i = 0, l = cm.length;
                    for (; i < l; i += 1) {
                        if (cm[i].name === columnName) {
                            return i; // return the index
                        }
                    }
                    return -1;
                };
    
            grid.jqGrid({
                colModel: [
                    ...
                    {name: 'action', index: 'action', width: 70, align: 'center', sortable: false},
                    ...
                ],
                ...
                loadComplete: function () {
                    var iCol = getColumnIndexByName($(this), 'action'), iRow, row,
                        rows = this.rows,
                        cRows = rows.length;
    
                    for (iRow = 0; iRow < cRows; iRow += 1) {
                        row = rows[iRow];
                        if ($.inArray('jqgrow', row.className.split(' ')) > 0) {
                            $(row.cells[iCol]).html("<a href='#' style='height:25px;width:120px;' onclick=\"jQuery('#list').jqGrid('delGridRow','" +
                                row.id + "',myDelParameters); return false;\">Del</>");
                        }
                    }
                });
        });
    //]]>
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jqgrid that contains some data, the first column of which is
Is there a way in jqgrid to have an editable column that uses a
I have a custom, multi-column sort attached to my jqGrid instance by means of
I have jqgrid that has 23 headers. It has edit dialog with a form
Is it possible to make it so that a jqGrid will have a width
I have a column model like that: ... {name:'password',index:'password', width:100}, {name:'type.name',index:'type.name', width:100}, ... My
I have jqgrid and in that I have one custom navigation button to export
Experts, I have JQGrid with custom template column like Edit. the following screen display
I'm trying to get column reordering working in jqGrid 3.8.1, I have sortable set
Is there any way to hide a column in a jqGrid table, but have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.