Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - SDS

Pages: [1]
1
Help for ParamQuery Pro / In-Grid Edit is not working
« on: January 03, 2026, 09:08:03 pm »
Till date, we have been using the option to edit data in-grid. but it suddenly stopped without any code changes. I am not able to trace the error. please find below the code which we use and guide. Surprisingly, i am able to paste (Ctrl-V) into the editable cells and able to delete existing content (Del key), but not able to type anything. Columns are of different types (Text, Numeric and Date). none of them are working. I tried breakpoint at editorBegin: event but it doesn't hit too. (I have attached the ColModel for your reference)

Thanks in advance.

    function GridReload() {
        //$('.spinner').show();
        try { $("#list").pqGrid("destroy"); } catch { }
        var mcolModel, ColTypes, ClrCond;
        var mtotalrec = 0;
        mallowEdit = false;
        if ("@ViewBag.Header" == "My Menu" || "@ViewBag.Header" == "Dashboard Objects" || '@Model.ViewDataId' == 'MyMenu' || '@Model.ViewDataId' == 'DashboardObjects' || '@Model.OptionCode' == "OFWFormDesigner" || '@Model.OptionCode' == "OFWDocDesigner")
        {
            var murlcolModel = "/Setup/MasterGrid/GetGridStructureRecords/[email protected]&mformatcode=" + $("#formats").val() + '&TableName=' + '@ViewBag.Table' + '&AcType=' + '@Model.MainType' + '&MainType=' + $("#Modules").val();
            $("#hdnparastring").val('&mParaString=AcType^' + '@Model.MainType' + '~MainType^' + $("#Modules").val());
        }else
        {
            var murlcolModel = "/Setup/MasterGrid/GetGridStructureRecords/[email protected]&mformatcode=" + $("#formats").val() + '&TableName=' + '@ViewBag.Table' + '&AcType=' + '@Model.MainType' + '&MainType=' + '@Model.MainType';
            $("#hdnparastring").val('&mParaString=AcType^' + '@Model.MainType' + '~MainType^' + '@Model.MainType');
        }
        $.ajax({
            url: murlcolModel,
            type: "POST",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                var obj = $.parseJSON(data);
                mallowEdit = obj[0].substring(0, 1) == "Y";
                mcolModel = obj[1];
                //ColTypes = obj[3].split(",");
                //ClrCond = obj[4].split(",");
                CreateGridData();
                $('.spinner').hide();
            },
            error: function (jqXHR, textStatus, errorThrown) {
                alert("Server Side Error!");
            }
        });

        function CreateGridData() {
            //for (var i = 0; i < mcolModel.length - 1; ++i) {
            //    if (mcolModel["type"] != null && mcolModel["type"] == "checkbox") {
            //        mcolModel["cb"] = JSON.parse('{ "all": "false", "header": "false"}');
            //    }
            //}
            var mgroupModel = {
                on: true,
                merge: false,
                fixCols: true,
                showSummary: [true], //to display summary at end of every group.
                grandSummary: true
            };
            if ("@ViewBag.Header" == "My Menu" || "@ViewBag.Header" == "Dashboard Objects" || '@Model.ViewDataId' == 'MyMenu' || '@Model.ViewDataId' == 'DashboardObjects' || '@Model.OptionCode' == "OFWFormDesigner" || '@Model.OptionCode' == "OFWDocDesigner")
            {
                var murldataModel = "/Setup/MasterGrid/[email protected]&MainType=" + $("#Modules").val() + "&ViewDataId=" + $("#formats").val() + '&searchField=' + $('#searchField').val() + '&searchString=' + $('#searchString').val() + '&searchOper=' + $('#searchOper').val();
            }else
            {
                var murldataModel = "/Setup/MasterGrid/[email protected]&[email protected]&ViewDataId=" + $("#formats").val() + '&searchField=' + $('#searchField').val() + '&searchString=' + $('#searchString').val() + '&searchOper=' + $('#searchOper').val();
            }
            var mdataModel = {
                location: "remote",
                dataType: "JSON",
                method: "POST",
                url: murldataModel,
                sorting: "local",
                paging: "local",
                recIndx: "Document",
                getData: function (dataJSON, textStatus, jqXHR) {
                    mtotalrec = dataJSON.totalRecords;
                    return { curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords, data: dataJSON.data };
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    var mmsg = jqXHR.responseText.replace('{', '').replace('}', '');
                    mmsg = mmsg.replace('"Message":"', '');
                    mmsg = mmsg.replace('"', '')
                    alert('Error!\n' + mmsg);
                    //alert(errorThrown);
                }
            };
            // edit
            mcolModel[0].skipFocus = true;
            if (mallowEdit == false) {
                mcolModel[0].render = Function("ui", "return \"<button type = 'button' style='width:35px;height:20px;' class= 'edit_btn' >Edit</button>\";");
            } else {
                mcolModel[0].render = Function("ui", "return \"<button type = 'button' style='width:35px;height:20px;' class= 'edit_btn' >Save</button>\";");
            }
            //mcolModel[0].render = Function("ui", "return \"<button type = 'button' style='width:40px;height:20px;' class= 'edit_btn' >Edit<i class='ui-icon-pencil'></i>\";");
            var mfunc = "var rowIndx = ui.rowIndx,grid = this,$cell = grid.getCell(ui);";
            mfunc += "$cell.find(\".edit_btn\").button()";
            mfunc += ".on(\"click\"," + Function("evt", "editRow(rowIndx, grid);") + ");";
            //mfunc += ".on(\"click\"," + Function("evt", "if (isEditing(grid)) {return false;} editRow(rowIndx, grid, true);") + ");if (grid.hasClass({ rowData: ui.rowData, cls: 'pq-row-edit' })) { editRow(rowIndx, grid);} ";
            mcolModel[0].postRender = Function("ui", mfunc);
            // delete
            mcolModel[1].skipFocus = true;
            mcolModel[1].render = Function("return \"<button type = 'button' style='width:35px;height:20px;' class= 'delete_btn' >Del</button>\";");
            var mfunc = "var rowIndx = ui.rowIndx,grid = this,$cell = grid.getCell(ui);";
            mfunc += "$cell.find(\".delete_btn\").button({ icons: { primary: 'ui-icon-scissors'} })";
            mfunc += ".on(\"click\"," + Function("evt", "deleteRow(rowIndx, grid);") + ");";
            mcolModel[1].postRender = Function("ui", mfunc);
            if (mallowEdit == false) {
                // view
                mcolModel[2].skipFocus = true;
                mcolModel[2].render = Function("return \"<button type = 'button' style='width:35px;height:20px;' class= 'view_btn' >View</button>\";");
                var mfunc = "var rowIndx = ui.rowIndx,grid = this,$cell = grid.getCell(ui);";
                mfunc += "$cell.find(\".view_btn\").button({ icons: { primary: 'ui-icon-search'} })";
                mfunc += ".on(\"click\"," + Function("evt", "viewRow(rowIndx, grid);") + ");";
                mcolModel[2].postRender = Function("ui", mfunc);
                // Print
                mcolModel[3].skipFocus = true;
                mcolModel[3].render = Function("return \"<button type = 'button' style='width:35px;height:20px;' class= 'print_btn' >Print</button>\";");
                var mfunc = "var rowIndx = ui.rowIndx,grid = this,$cell = grid.getCell(ui);";
                mfunc += "$cell.find(\".print_btn\").button({ icons: { primary: 'ui-icon-print'} })";
                mfunc += ".on(\"click\"," + Function("evt", "printRow(rowIndx, grid);") + ");";
                mcolModel[3].postRender = Function("ui", mfunc);
            }

            var gridobj = {
                colModel: mcolModel,
                dataModel: mdataModel,
                postRenderInterval: -1, //synchronous post rendering.
                collapsible: false,
                showTitle: false,
                showToolbar: false,
                roundCorners: true,
                menuIcon: true,
                freezeCols: 0,
                freezeRows: 0,
                scrollModel: { autoFit: false },
                height: $(window).height() - 154,/*38 for search panel*/
                numberCell: { resizable: false, width: 30, title: "#" },
                resizable: false,
                editable: true,
                wrap: true,
                flex: { one: true },
                pageModel: { type: "remote", height: 30, strRpp: "{0}", strDisplay: "{0} to {1} of {2}", rPP: 100, rPPOptions: [20, 50, 100, 200, 500, 1000, 5000, 10000] },
                //pageModel: { type: "local", rPP: 50, strRpp: "{0}", strDisplay: "{0} to {1} of {2}" },
                //editor: { type: 'textbox', select: true, style: 'outline:none;' },
                //validation: { icon: 'ui-icon-info' },
                rowInit: function (ui) {
                    //$('.edit_btn').html('<img src="/Content/Images/edit-icon.png" />');
                    //$('.delete_btn').html('<img src="/Content/Images/delete-icon.ico" />');
                    //$('.view_btn').html('<img src="/Content/Images/print-icon.ico" />');
                    return {
                        //style: { "background": "yellow" } //can also return attr (for attributes) and cls (for css classes) properties.
                    };
                },
                editorBegin: function (evt, ui) {
                    debugger;
                },
                rowClick: function (event, ui) {
                    currentrow = ui.rowIndx;
                    $("#page-subgrid").hide();
                    $('#SelectedDocument').val(this.pdata[ui.rowIndx]["Document"]);
                    if ("@ViewBag.DrillQuery" != "")
                        GridReload2(this.pdata[ui.rowIndx]["Document"]);
                        //GridReload2($.trim(this.pdata[ui.rowIndx]["Document"]));
                    //GridReload2($.trim(pq.grid("#list").pdata[ui.rowIndx]["Document"]));
                },
                cellDblClick: function (event, ui) {
                    currentrow = ui.rowIndx;
                },
                complete: function (event, ui) {
                    if ("@ViewBag.DrillQuery" != "") {
                        //var mdoc = $.trim(this.pdata[1]["Document"]);
                        var mdoc = this.pdata[0]["Document"];
                        GridReload2(mdoc);
                    }
                    //$('.edit_btn').html('<img src="/Content/Images/edit-icon.png" />');
                    //$('.delete_btn').html('<img src="/Content/Images/delete-icon.ico" />');
                    //$('.view_btn').html('<img src="/Content/Images/print-icon.ico" />');
                    //for (var i = 0; i < mtotalrec; i++) {
                    //    var ed = "<button type='button' href='' id='btnEdit" + i + "' value='" + i + "' style='padding:0px;font-size:20px;' class='btn editdelete' tooltip='Edit' , title='Edit' , attr='" + i + "'><i class='fa fa-edit'></i>";
                    //    jQuery("#list").pqGrid('setRowData', i, { .XEdit: ed });
                    //}
                    //    var column = grid.getColumn({ dataIndx: ".XEdit" });
                    //    var rows = grid.getRowsByClass({ cls: 'pq-grid-row' });
                    //    rowData = grid.getRowData({ rowIndx: rowIndx })
                    //    return null;
                }
                //,create: function () {
                //    var obj = $.paramquery.tableToArray($("#list"));
                //    obj.colModel[0].render = function (ui) {
                //        return "<button type='button' class='edit_btn'>Edit</button>\<button type='button' class='delete_btn' id='btnUpd'>Delete</button>";
                //    }
                //}
            };
            //$("#list").pqGrid(gridobj);
            //var grid = pq.grid("#list", gridobj);
            pq.grid("#list", gridobj);
        }
    }

2
Hi!,
I have a grid column of string type. the data has leading variable spaces in the text. but when displayed it removes the space. the text property of the cell still shows the space embedded but its removed in the grid.
 

3
ParamQuery Pro Evaluation Support / Re: first column is blank
« on: June 11, 2024, 06:48:17 pm »
I am not able to use jsfiddle. My application is in ASP.NET MVC C#.

I have attached the complete VIEW and Controller code of the source.

4
ParamQuery Pro Evaluation Support / Re: add a button to cell
« on: June 09, 2024, 12:44:01 pm »
Solved, thanks. But I have another urgent query which I have raised in another post, regarding blank first column. please look into the same, thanks.

5
ParamQuery Pro Evaluation Support / first column is blank
« on: June 09, 2024, 12:40:49 pm »
the first column in the grid is always showing blank, though the header is correct and data in the datamodel is also correct but the data is blank.
attached the colModel and dataModel. Am I missing something?

6
ParamQuery Pro Evaluation Support / add a button to cell
« on: June 01, 2024, 11:44:28 am »
I am trying to add a button to the first cell of each row in the grid. I referred to the other forum topics and tried to imitate the solution but doesn't work for me. the grid works fine untill I add render in the colmodel. please find attached the colmodel and error screen shot, please suggest if anything wrong with the render definition.

7
ParamQuery Pro Evaluation Support / Re: Remote Load not working
« on: May 30, 2024, 04:59:31 pm »
The above problem is solved for now.. Thanks

8
ParamQuery Pro Evaluation Support / Re: Remote Load not working
« on: May 30, 2024, 02:48:01 pm »
If it were a problem with datamodel or colmodel, then it should not work at all even on click of Pager refresh button. Is there anything I am missing in the source I have provided?

9
ParamQuery Pro Evaluation Support / Remote Load not working
« on: May 30, 2024, 10:24:57 am »
First of all, Congratulations on such a wonderful software "Product" from India.

My Query:
The grid when configured for "remote" load, doesn't get refreshed automatically. Initially it shows a blank grid with no headers, only pager but on Refresh button click on Pager displays the complete grid as expected with data.

In browser console I get a message as shown in the attachments.
Even it doesn't hit the "actionresult" code in the controller untill refresh button click. I have attached the View part of the code.

Please guide on the query. Thanks in advance. 

Pages: [1]