Poppy
Poppy

Reputation: 3092

How to position the delete dialog in inline jquery grid?

I am using jquery inline grid for my application. I have a delete option at the last column of my grid.

{
                name:'deleteaction',
                index:'deleteaction',
                width:50,
                align:'center',
                formatter:'actions',
                formatoptions:{
                     editbutton:false,
                     delbutton:true,
                     contentType: "application/json", 
                     delOptions: { 
                         url: 'sample/delData',
                         mtype: 'DELETE', 
                         mcontentType: "application/json", 
                         serializeDelData : function(postData) {
                            delete postData["id"];
                            var selrow = jQuery('#stdlst').jqGrid('getGridParam', 'selrow');
                            var row = jQuery('#stdlst').jqGrid('getRowData', selrow);
                            postData.code = row.code;
                            var jsonData = JSON.stringify(postData);
                            return jsonData;
                        },
                       reloadAfterSubmit:true,
                      onclickSubmit: function (options, rowid) {
                         var selrow = jQuery('#stdlst').jqGrid('getGridParam', 'selrow');
                         var rowData = jQuery('#stdlst').jqGrid('getRowData', selrow);
                         options.url += "&" + $.param({
                             code: rowData.code
                         });
                      }
                     }
               }

On click of the delete button, I could see jquery's default delete confirmation popup coming up on the top left of the grid. Is there a way to customize the dialog? I want to display my custom dialog and not jq dialog. The custom dialog would do the exact function as the default dialog. Please help me out. Thanks

Upvotes: 0

Views: 888

Answers (1)

Oleg
Oleg

Reputation: 222007

formatoptions.delOptions of formatter:'actions' allows to specify any properties or any callback of delGridRow. So you can use afterShowForm for example to change the position of the Delete dialog. See the answer for the code example or another one.

Upvotes: 1

Related Questions