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 - Sunny

Pages: [1] 2 3 4
1
Hi Admin,

When we use 'Commit' method with type 'add', we update the primarykey(recIndx, which is generated at server side) and can be displayed in UI for that row. Is there a way, when we use 'Commit' method with type 'update', the row data in the grid should be updated with the data that comes back from server that matches the primary key ?

Looks like the commit method for update operation works for only data changes made on the client side. I have requirement,that when a cell status gets changed by user from 'A' to 'B', I have to populate the partial data for that row from the database into the grid. I did debug, and can see the changes are coming back from server are being passed in to the commit method ...

Thanks.

2
Help for ParamQuery Pro / Re: Issue with Calculations while Copy/Paste
« on: October 21, 2015, 08:16:25 pm »
Thank you.

3
News / Re: Upgrade to Pro Version 3.2.0
« on: October 16, 2015, 09:42:51 pm »
Hi Admin,

We would like to upgrade to 3.2.0, as my users are interested to use features like Cut/Paste,using Delete key,export functionality. But, there is a concern you mentioned that checkbox column is not supported in IE8.

We are using checkbox column in the grid, to select the rows that needs to be deleted, our grid also contains column grouping as well. Not sure, if this gets affected after upgrade to 3.2.0 ? Can you advice, if its completely not supported or only partial features (which we may not be using it)?

Thanks.

4
Help for ParamQuery Pro / Re: Issue with Calculations while Copy/Paste
« on: October 16, 2015, 09:32:18 pm »
Thank you for sharing the code with the solution. I thought of using the change event , but I didn't like the way the code has to repeated twice in render function and also in the change function. As, I have 5 to 6 calculated columns in my grid.

I am not sure, if there is another way or possible to change refreshRow method which should render all the cells in the row including that are not available in the viewport.

5
Help for ParamQuery Pro / Re: Issue with Calculations while Copy/Paste
« on: October 16, 2015, 01:06:32 am »
Hi,

With little more effort, I am able to provide you test case using one of your demo for AutoSave example at:http://paramquery.com/pro/demos/editing_instant
You can copy paste below code in the example and can notice the behavior. The changes I made to the code are
  • Enabled QuantityPerUnit column and titled as TotalCost, added render function to act as calcualted column
  • Added Refresh call in Change function
  • Added virtualX:true, virtualY:true

You can notice the issue, when you select the 'Units in Stock' cell in the first row, and do Cntrl+Shift+End keys, which will select the whole column and paste (using Cntrl+V) some value. It should re-calculate the 'Total Cost' column now. You can observe in the Firebug console, updateList in the Post request doesn't reflect the changes for the first few rows in 'QuantityPerUnit' column.

This code works fine when I remove virtualX:true and virtualY:true !!!

Code: [Select]

    $(function () {
        var obj = {
            hwrap: false,
            resizable: true,
            rowBorders: false,
            numberCell: { show: true },
            trackModel: { on: true }, //to turn on the track changes.           
            toolbar: {
                items: [
                    { type: 'button', icon: 'ui-icon-plus', label: 'New Product', listener:
                        { "click": function (evt, ui) {
                            //append empty row at the end.                           
                            var rowData = { ProductName: 'new product', UnitPrice: 0.2 }; //empty row
                            var rowIndx = grid.addRow({ rowData: rowData });
                            grid.goToPage({ rowIndx: rowIndx });
                            grid.editFirstCellInRow({ rowIndx: rowIndx });
                        }
                        }
                    },
                    { type: 'separator' },
                    { type: 'button', icon: 'ui-icon-arrowreturn-1-s', label: 'Undo', cls: 'changes', listener:
                        { "click": function (evt, ui) {
                            grid.history({ method: 'undo' });
                        }
                        },
                        options: { disabled: true }
                    },
                    { type: 'button', icon: 'ui-icon-arrowrefresh-1-s', label: 'Redo', listener:
                        { "click": function (evt, ui) {
                            grid.history({ method: 'redo' });
                        }
                        },
                        options: { disabled: true }
                    },
                    {
                        type: "<span class='saving'>Saving...</span>"
                    }
                ]
            },
            scrollModel: {
                autoFit: true
            },
            historyModel: {
                checkEditableAdd: true
            },
            editor: {
                select: true
            },
            title: "<b>Auto save</b>",
            change: function (evt, ui) {

                var grid = this;
                if (grid.isDirty() && grid.isValidChange({allowInvalid: true}).valid) {
    grid.refresh();                           
                    var changes = grid.getChanges({ format: 'byVal' });
                    $.ajax({
                        url: '/pro/products/batch',
                        data: {
                            list: JSON.stringify({
                                updateList: changes.updateList,
                                addList: changes.addList,
                                deleteList: changes.deleteList
                            })
                        },
                        dataType: "json",
                        type: "POST",
                        async: true,
                        beforeSend: function (jqXHR, settings) {
                            $(".saving", grid.widget()).show();
                        },
                        success: function (changes) {
                            //commit the changes.
    grid.commit({ type: 'add', rows: changes.addList });
                            grid.commit({ type: 'update', rows: changes.updateList });
                            grid.commit({ type: 'delete', rows: changes.deleteList });
                        },
                        complete: function () {
                            $(".saving", grid.widget()).hide();
                        }
                    });
                }
            },
            history: function (evt, ui) {
                var $grid = this.widget();
                if (ui.canUndo != null) {
                    $("button.changes", $grid).button("option", { disabled: !ui.canUndo });
                }
                if (ui.canRedo != null) {
                    $("button:contains('Redo')", $grid).button("option", "disabled", !ui.canRedo);
                }
                $("button:contains('Undo')", $grid).button("option", { label: 'Undo (' + ui.num_undo + ')' });
                $("button:contains('Redo')", $grid).button("option", { label: 'Redo (' + ui.num_redo + ')' });
            },
            colModel: [
                { title: "Product ID", dataType: "integer", dataIndx: "ProductID", editable: false, width: 80 },
                { title: "Product Name", width: 165, dataType: "string", dataIndx: "ProductName",
                    validations: [
                        { type: 'minLen', value: 1, msg: "Required" },
                        { type: 'maxLen', value: 40, msg: "length should be <= 40" }
                    ]
                },
                { title: "Total Cost", hidden: false, width: 140, dataType: "string", align: "right", dataIndx: "QuantityPerUnit",
                    render:function(ui){
     ui.rowData.QuantityPerUnit = ui.rowData.UnitPrice * ui.rowData.UnitsInStock;
     ui.cellData = ui.rowData.QuantityPerUnit;
     return ui.cellData;
}
                },
                { title: "Unit Price", width: 100, dataType: "float", align: "right", dataIndx: "UnitPrice",
                    validations: [
                        { type: 'nonEmpty', msg: "Required" },
                        { type: 'gt', value: 0.5, msg: "better be > 0.5", warn: true}],
                    render: function (ui) {
                        var cellData = ui.cellData;
                        if (cellData != null) {
                            return "$" + parseFloat(ui.cellData).toFixed(2);
                        }
                        else {
                            return "";
                        }
                    }
                },
                { title: "Units In Stock", width: 100, dataType: "integer", align: "right", dataIndx: "UnitsInStock",
                    validations: [{ type: 'gte', value: 0, msg: "Required"}]
                },
                { title: "Discontinued", width: 100, dataType: "bool", align: "center", dataIndx: "Discontinued",
                    editor: false,
                    type: 'checkbox',
                    validations: [{ type: 'nonEmpty', msg: "Required"}]
                },
                { title: "", editable: false, minWidth: 85, sortable: false,
                    render: function (ui) {
                        return "<button type='button' class='delete_btn'>Delete</button>";
                    },
                    postRender: function (ui) {
                        var grid = this,
                            $cell = grid.getCell(ui);
                        $cell.find(".delete_btn")
                            .button({ icons: { primary: 'ui-icon-scissors'} })
                            .bind("click", function (evt) {
                                grid.deleteRow({ rowIndx: ui.rowIndx });
                            });
                    }
                }
            ],
            postRenderInterval: -1, //synchronous post render.
            pageModel: { type: "local", rPP: 20 },
virtualX:true,virtualY:true,
            dataModel: {
                dataType: "JSON",
                location: "remote",
                recIndx: "ProductID",
                url: "/pro/products/get", //for ASP.NET
                //url: "/pro/products.php", //for PHP
                getData: function (response) {
                    return { data: response.data };
                }
            },
            load: function (evt, ui) {
                var grid = this,
                    data = grid.option('dataModel').data;

                grid.widget().pqTooltip(); //attach a tooltip.

                //validate the whole data.
                grid.isValid({ data: data });
            }
        };
        var grid = pq.grid("#grid_editing", obj);
    });




6
Help for ParamQuery Pro / Issue with Calculations while Copy/Paste
« on: October 15, 2015, 01:45:49 am »
 Hi,

My calculations were not working properly while I am doing copy/paste in my grid (where I use VirtualX and VirtualY as true).

As an example, Lets say my grid has 30 rows with no paging and has vertical scrolling. I have 3 columns which are A,B,C a
A - Discount value (editable field)
B- Original Price (not editable)
C- Calculated based on A and B columns based on the formula : B*(100-A)/100) . Wrote this formula in the column render as a function.

And the top of the grid I display a Summary value which Sum of Column C.

When I copy paste some value (10) in column A , my summary is calculated only with the 10 rows which are visible(rendered) at that time in the grid, and the rest 20 rows are not been counted since they have not been rendered, which made my summary calculation incorrect.

Please advice.

7
Thank you very much.

8
Hi,

Is there any way or workaround to export the rendered cells ? In that way it solves two issues,

1. It will prevent showing Id instead of Value(in drop-down columns) and
2. other it would prevent displaying 'undefined' where some cells are blank..

Appreciate in advance.

Regards.

9
Help for ParamQuery Pro / Re: Column editor:select type not changing options
« on: September 08, 2015, 09:57:16 pm »
Hi,

While I do copy/paste the cells in the column(that has select editor), the dependant columns are not being updated. Can you please advice.

I tried in one of your demo, cascading select lists: http://paramquery.com/pro/demos/edit_select, after I selected three different options in column(Shipping Via) for first 3 rows, then I copied 'Speedy Express' in to the other rows which didn't update the 'Shipping Via ID' column.

Attached screenshot.

10
Thank you for the update on this. Much appreciated.

I already used logic like,while iterating over the rows,copy from one column to other, and later send the updated list of copied data to the server in one call.

11
Help for ParamQuery Pro / Question on Refresh method, Editing
« on: September 01, 2015, 01:18:40 am »
Hi,

I have couple of questions.

1. I knew, up arrow and down arrow works when the cell is in edit mode, but wondering if its possible to also use the left arrow,right arrow keys when the cell is in edit mode ? (same like in excel)

2. My calculated column(say ColB) is at right most of the grid, which is visible only horizontal scroll bar is used. This column is calculated based on one of the column(say ColA) which is on left most side of grid. My grid uses 'AutoSave' option.
Problem is: When I enter value in ColA, calculated value in ColB is not been sent to backend to save, only ColA is being sent. I used refresh method in Change event for updates, but still doesn't help.
I could replicate this in your 'AutoSave' demo. Please find below code, I added two columns 'Units on Order', 'ReOrderLevel'. 'ReOrder Level' column is calcualted one.. Added console statement in change event, to notice the behavior.



    $(function () {
        var obj = {
            hwrap: false,
            resizable: true,
            rowBorders: false,           
            numberCell: { show: true },
            trackModel: { on: true }, //to turn on the track changes.           
            toolbar: {
                items: [
                    { type: 'button', icon: 'ui-icon-plus', label: 'New Product', listener:
                        { "click": function (evt, ui) {
                            //append empty row at the end.                           
                            var rowData = { ProductName: 'new product', UnitPrice: 0.2 }; //empty row
                            var rowIndx = $grid.pqGrid("addRow", { rowData: rowData });
                            $grid.pqGrid("goToPage", { rowIndx: rowIndx });
                            $grid.pqGrid("setSelection", null);
                            $grid.pqGrid("setSelection", { rowIndx: rowIndx, dataIndx: 'ProductName' });
                            $grid.pqGrid("editFirstCellInRow", { rowIndx: rowIndx });
                        }
                        }
                    },
                    { type: 'separator' },
                    { type: 'button', icon: 'ui-icon-arrowreturn-1-s', label: 'Undo', cls: 'changes', listener:
                        { "click": function (evt, ui) {
                            $grid.pqGrid("history", { method: 'undo' });
                        }
                        },
                        options: { disabled: true }
                    },
                    { type: 'button', icon: 'ui-icon-arrowrefresh-1-s', label: 'Redo', listener:
                        { "click": function (evt, ui) {
                            $grid.pqGrid("history", { method: 'redo' });
                        }
                        },
                        options: { disabled: true }
                    },
                    {
                        type: "<span class='saving'>Saving...</span>"
                    }
                ]
            },
            width:600,
         height:400,
            historyModel: {
                checkEditableAdd: true
            },
            editModel: {
                //allowInvalid: true,
                saveKey: $.ui.keyCode.ENTER,
                uponSave: 'next'
            },
            editor: {
                select: true
            },
            title: "<b>Auto save</b>",
            change: function (evt, ui) {
                //debugger;
                if (ui.source == 'commit' || ui.source == 'rollback') {
                    return;
                }
                console.log(ui);
                var $grid = $(this),
                    grid = $grid.pqGrid('getInstance').grid;
                var rowList = ui.rowList,
                    addList = [],
                    recIndx = grid.option('dataModel').recIndx,
                    deleteList = [],
                    updateList = [];

                for (var i = 0; i < rowList.length; i++) {
                    var obj = rowList,
                        rowIndx = obj.rowIndx,
                        newRow = obj.newRow,
                        type = obj.type,
                        rowData = obj.rowData;
                    if (type == 'add') {
                        var valid = grid.isValid({ rowData: newRow, allowInvalid: true }).valid;
                        if (valid) {
                            addList.push(newRow);
                        }
                    }
                    else if (type == 'update') {
                        var valid = grid.isValid({ rowData: rowData, allowInvalid: true }).valid;
                        if (valid) {
                            if (rowData[recIndx] == null) {
                                addList.push(rowData);
                            }
                            //else if (grid.isDirty({rowData: rowData})) {
                            else {
                        grid.refresh();
                                updateList.push(rowData);
                        console.log(rowData);
                            }
                        }
                    }
                    else if (type == 'delete') {
                        if (rowData[recIndx] != null) {
                            deleteList.push(rowData);
                        }
                    }
                }
                if (addList.length || updateList.length || deleteList.length) {
                    $.ajax({
                        url: '/pro/products/batch',
                        data: {
                            list: JSON.stringify({
                                updateList: updateList,
                                addList: addList,
                                deleteList: deleteList
                            })
                        },
                        dataType: "json",
                        type: "POST",
                        async: true,
                        beforeSend: function (jqXHR, settings) {
                            $(".saving", $grid).show();
                        },
                        success: function (changes) {
                            //commit the changes.               
                            grid.commit({ type: 'add', rows: changes.addList });
                            grid.commit({ type: 'update', rows: changes.updateList });
                            grid.commit({ type: 'delete', rows: changes.deleteList });
                        },
                        complete: function () {
                            $(".saving", $grid).hide();
                        }
                    });
                }
            },
            history: function (evt, ui) {
                var $grid = $(this);
                if (ui.canUndo != null) {
                    $("button.changes", $grid).button("option", { disabled: !ui.canUndo });
                }
                if (ui.canRedo != null) {
                    $("button:contains('Redo')", $grid).button("option", "disabled", !ui.canRedo);
                }
                $("button:contains('Undo')", $grid).button("option", { label: 'Undo (' + ui.num_undo + ')' });
                $("button:contains('Redo')", $grid).button("option", { label: 'Redo (' + ui.num_redo + ')' });
            },
            colModel: [
                { title: "Product ID", dataType: "integer", dataIndx: "ProductID", editable: false, width: 80 },
                { title: "Product Name", width: 165, dataType: "string", dataIndx: "ProductName",
                    validations: [
                        { type: 'minLen', value: 1, msg: "Required" },
                        { type: 'maxLen', value: 40, msg: "length should be <= 40" }
                    ]
                },
                { title: "Quantity Per Unit", hidden: true, width: 140, dataType: "string", align: "right", dataIndx: "QuantityPerUnit",
                    validations: [
                        { type: 'minLen', value: 1, msg: "Required." },
                        { type: 'maxLen', value: 20, msg: "length should be <= 20" }
                    ]
                },
                { title: "Unit Price", width: 100, dataType: "float", align: "right", dataIndx: "UnitPrice",
                    validations: [
                        { type: 'nonEmpty', msg: "Required" },
                        { type: 'gt', value: 0.5, msg: "better be > 0.5", warn: true}],
                    render: function (ui) {
                        var cellData = ui.cellData;
                        if (cellData != null) {
                            return "$" + parseFloat(ui.cellData).toFixed(2);
                        }
                        else {
                            return "";
                        }
                    }
                },
                { title: "Units In Stock", width: 100, dataType: "integer", align: "right", dataIndx: "UnitsInStock",
                    validations: [{ type: 'gte', value: 0, msg: "Required"}]
                },
                { title: "Discontinued", width: 100, dataType: "bool", align: "center", dataIndx: "Discontinued",
                    editor: { type: "checkbox", subtype: 'triple', style: "margin:3px 5px;" },
                    validations: [{ type: 'nonEmpty', msg: "Required"}]
                },
                { title: "Units On Order", width: 100, dataType: "integer", align: "right", dataIndx: "UnitsOnOrder"
                },
            { title: "Reorder Level", width: 100, dataType: "integer", align: "right", dataIndx: "ReorderLevel",
                    editable:false,
               render:function(ui){
                  ui.rowData['ReorderLevel'] = parseFloat(ui.rowData['UnitsOnOrder']/ui.rowData['UnitsInStock']).toFixed(0);
                  return ui.rowData['ReorderLevel'];
               }
                },
            { title: "", editable: false, minWidth: 85, sortable: false,
                    render: function (ui) {
                        return "<button type='button' class='delete_btn'>Delete</button>";
                    }
                }
            ],
            pageModel: { type: "local", rPP: 20 },
            dataModel: {
                dataType: "JSON",
                location: "remote",
                recIndx: "ProductID",
                url: "/pro/products/get", //for ASP.NET
                //url: "/pro/products.php", //for PHP
                getData: function (response) {
                    return { data: response.data };
                }
            },
            load: function (evt, ui) {
                var grid = $(this).pqGrid('getInstance').grid,
                    data = grid.option('dataModel').data;
                $(this).pqTooltip();
                var ret = grid.isValid({ data: data, allowInvalid: false });
            },
            refresh: function () {
                $("#grid_editing").find("button.delete_btn").button({ icons: { primary: 'ui-icon-scissors'} })
                .unbind("click")
                .bind("click", function (evt) {
                    var $tr = $(this).closest("tr");
                    var rowIndx = $grid.pqGrid("getRowIndx", { $tr: $tr }).rowIndx;
                    $grid.pqGrid("deleteRow", { rowIndx: rowIndx });
                });
            }
        };
        var $grid = $("#grid_editing").pqGrid(obj);
    });









12
Help for ParamQuery Pro / Re: Save the Grid Maintanance per User
« on: August 21, 2015, 07:08:51 pm »
Thank you. Appreciate if you can let me know when next version will be available, so that I can let my users know.

13
Help for ParamQuery Pro / Re: Save the Grid Maintanance per User
« on: August 21, 2015, 12:12:36 am »
Hi,

In my grid, user has option to freeze/unfreeze columns. So, while testing noticed Freeze/Unfreeze column position is not been saved via 'saveState' .

Can you please advice?

Thanks.

14
Hi,

As per API isValid API, http://paramquery.com/pro/api#method-isValid, validation msg will be shown in tooltip when allowInvalid is passed as false. I noticed it is working vice-versa, tool-tip is been shown when allowInvalid is passed as true.

You can verify this at demo: http://paramquery.com/pro/demos/editing_instant, line 79 and 85.

Can you please advice.

15
Help for ParamQuery Pro / Display disabled textarea in grid
« on: August 17, 2015, 04:49:48 pm »
Hi,

I looked in API and Demos, but couldn't find the way to display disabled text area editor in the grid. Can you please advise?

Thanks.

Pages: [1] 2 3 4