0

I'm using inline edit and delete functionality. I'm not using any editGridRow or delGridRow methods explicitly. I need to validate the data on the server side and display the results. In case of deleting, I have many events under delOptions property like afterSubmit, afterComplete. But for editing, I don't know the event that I should use to get the validation result from server and display it to user. Suggestions ?

//My action colmodel

colEditModel = {
            name: "actions",
            width: 90,
            formatter: "actions",
            sortable: false,
            search: false,
            formatoptions: {
                keys: true,
                editOptions: {},
                addOptions: {},
                delOptions: {
                    onclickSubmit: function (options) {
                        options.delData = {//Some data};
                        options.url = "Allocation/EditAllocation";
                    },
                }
            }
        };

// Grid

$("#jqGrid").jqGrid({
            url: "Allocation/GetAllocations",
            mtype: "GET",
            datatype: "json",
            colModel: col_model,
            colNames: col_names,
            postData: { selectedDate: dateValue, filterCriteria: criteria },
            editurl: "Allocation/EditAllocation",
            serializeRowData: function (postdata) {
                var requestData = { // some data};
                return requestData;
            },
            loadonce: true,
            viewrecords: false,
            height: 330,
            width: null,
            shrinkToFit: false,
            autoheight: true,
            pager: "#jqGridPager",
            scroll: false,
            rownumbers: false,
            treeGrid: false,
            gridview: true,

        });
Ranjith V
  • 298
  • 1
  • 3
  • 16
  • Please include always the information about the version of jqGrid, which you use, and from which fork of jqGrid. – Oleg Apr 28 '16 at 11:33
  • @Oleg - I'm using jqGrid v5.0.2 provided by Gurrido : (http://guriddo.net/) – Ranjith V Apr 28 '16 at 11:48
  • I wrote you that I develop *alternative fork*: [free jqGrid](https://github.com/free-jqgrid/jqGrid) after renaming jqGrid to Gurrido and making it commercial (see UPDATED part of [the answer](http://stackoverflow.com/a/4439755/315935) and [the prices](http://guriddo.net/?page_id=103334)). I provide no support for Guriddo. You should post your questions about Guriddo in [Guriddo form](http://guriddo.net/?page_id=4). – Oleg Apr 28 '16 at 11:53

1 Answers1

1

The exact implementation depand on the version of jqGrid which you use and from the fork of jqGrid which you use. If you use an old version of jqGrid then you can specify onError callback inside of formatoptions of formatter: "actions" to process errors of inline editing and to use delOptions.errorTextFormat (the errorTextFormat callback, which you have to define inside of the delOptions property of formatoptions).

It's important to understand, that server side validation is the same as any other the error reporting from the server. The server should return the error description as HTML fragments. The response have to use any error HTML status code (the value >=400).

Oleg
  • 220,925
  • 34
  • 403
  • 798