locked
Server side code for delete a row in JqGrid RRS feed

  • Question

  • User-1907931422 posted

    I have the jqgrid script.

            $(gridSelector).jqGrid('navGrid', pagerSelector,
                        {
                            //navbar options
                            edit: true,
                            editicon: 'ace-icon fa fa-pencil blue',
                            add: true,
                            addicon: 'ace-icon fa fa-plus-circle purple',
                            del: true,
                            delicon: 'ace-icon fa fa-trash-o red',
                            search: true,
                            searchicon: 'ace-icon fa fa-search orange',
                            refresh: true,
                            refreshicon: 'ace-icon fa fa-refresh green',
                            view: true,
                            viewicon: 'ace-icon fa fa-search-plus grey'
                        },
                        
                        {
                            //delete record form
                            recreateForm: true,
                            mtype: 'DELETE',
                            onclickSubmit: function (params, postdata) {
                                params.url = API_URL + 'DeleteVendor';
                            },
                            beforeShowForm: function (e) {
                                var form = $(e[0]);
                                if (form.data('styled')) return false;
    
                                form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />');
                                styleDeleteForm(form);
    
                                form.data('styled', true);
                            }
                        });
    
                jQuery(gridSelector).jqGrid('inlineNav', pagerSelector, { edit: true, add: true, del: true });
            });

    I am not sure how the server side code in Web API.

    // DELETE
            [System.Web.Http.HttpDelete()]
    
            public void DeleteVendor()
            {
                 // what here to get the data, I want to delete it.
            } 

    I tried the request, it only has "oper" and "id" parameters in the form.

    Tuesday, January 26, 2016 12:51 AM

Answers