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

Pages: [1] 2
1
Hello,

Thanks for your response

How can i add multiple rows concept in below snippet:

var rowIndx = $grid.pqGrid('addRow', { rowIndxPage: 0, rowData: rowData, checkEditable: false });

Please suggest me.
                        

2
Help for ParamQuery Pro / Insert Multiple Rows using addRow function
« on: April 07, 2021, 11:16:54 am »
Hello,

I want to add multiple rows on single click of addnew row button so please suggest me an example of this

Thanks

3
I am using lazy load for large data and Searching particular records in large data set but it's not working So, please provide necessary solution regarding this.

4
Help for ParamQuery Pro / Re: Large data set export into excel sheet
« on: December 24, 2020, 09:08:11 pm »
Thank you for your reply.

I am using the $_POST['pq_data']  variable under the API method for getting the selected row HTML which is using for generating an excel-sheet.

5
Help for ParamQuery Pro / Re: Large data set export into excel sheet
« on: December 24, 2020, 08:46:06 pm »
it's not passing $_POST['pq_data'] value into API method so, it's not generating Xls file. but when I am trying with some of the selected row ex  1-100 records then it's working fine.

6
Help for ParamQuery Pro / Large data set export into excel sheet
« on: December 24, 2020, 07:15:45 pm »
I have an issue with the large data set export into an excel sheet.  I am export 13k product into excel sheet using  blob = this.exportData({}); but it's not working properly it's working only for small data set. 

So please provide necessary solution regarding this

 blob = this.exportData({
                    url: "ajaxurl",
                    filename: JSON.stringify({
                        'filename': filename,
                        'ids': ids,
                        'groupIds': groupIds
                    }),
                    // render: true
                });
 if(typeof blob === "string"){ blob = new Blob([blob]);}
saveAs(filePath, exportedFileName);

7
Hello,

Thanks for your reply.

I understand your point but all things are working fine with Infinite scrolling.

And i want to continue using infinite scrolling.

So could you please suggest that how can i fix the issue while using Infinite scrolling?

Is there any custom solution? If there then please share that, I'll apply it.

Thanks

8
I've a grid with Infinite scrolling functionality.

I've a button there to add a new row so that user can enter data and it can be saved in database.

Autosave functionality is also enabled so as soon as i click on "New Item" button, grid saves itself and returns item ID.

All these things work fine when there are less rows.

Once there are a lot of rows and when i click on "New Items" button, grid scrolls to the bottom first and then adds a new row.

But Autosave does not call this time.

If i again click on "New Item" button then it creates a new row, first cell is in edit mode and then Autosave calls automatically and then it returns ID for the newly added row.

I am not sure why i does not call autosave first time when grid scrolls to bottom and a new row is added.

Please suggest what should i need to do.

Here is my toolbar code:
toolbar: {
    items: [{
        type: 'button',
        icon: 'ui-icon-plus',
        label: 'New Item',
        listener: function () {
            //append empty row at the end.
            var rowData = {
                catAttr_138022: "",
                catAttr_138021: "",
            }; //empty row template
            var rowIndx = $grid.pqGrid('addRow', { rowData: rowData });
            $grid.pqGrid('goToPage', { rowIndx: rowIndx });
            $grid.pqGrid('editFirstCellInRow', { rowIndx: rowIndx });
        }
    },
    { type: 'separator' },
    {
        type: 'button',
        icon: 'ui-icon-arrowreturn-1-s',
        label: 'Undo',
        cls: 'changes',
        options: { disabled: true },
        listener: {
            "click": function (evt, ui) {
                    $grid.pqGrid("history", { method: 'undo' });
                }
        }
    },
    {
        type: 'button',
        icon: 'ui-icon-arrowrefresh-1-s',
        label: 'Redo',
        options: { disabled: true },
        listener: {
            "click": function (evt, ui) {
                    $grid.pqGrid("history", { method: 'redo' });
                }
        }
    }]
},

9
Help for ParamQuery Pro / Re: How to export selected rows from grid
« on: June 13, 2018, 10:26:20 am »
Hi,

Your solutions is working correctly.

Now all things working fine.

Thank you so much  :)

Cheers

10
Help for ParamQuery Pro / Re: How to export selected rows from grid
« on: June 12, 2018, 05:57:05 pm »
Hi,

Thank you so much for helping me to figure out the issues.

Now it is working fine.

This is how i am resetting filter:

Code: [Select]
this.filter({
    oper: 'replace',
    rules: []
});

Correct me if i am wrong?

Also can you please guide me, How can i exclude checkbox column in exported excel file?

Many thanks again.

You are awesome!

11
Help for ParamQuery Pro / Re: How to export selected rows from grid
« on: June 11, 2018, 03:57:19 pm »
Please consider , (comma) in these lines of code between format and render properties:

Code: [Select]
blob = this.exportData({
                                format: format
                                render: true
                            });

as I've comma after format: format in my code but missed it in posted code.

Sorry for inconvenience.

Thanks

12
Help for ParamQuery Pro / Re: How to export selected rows from grid
« on: June 11, 2018, 03:36:45 pm »
HI,

Thanks for correcting my mistake.

Now there is no error in console.

Now my code looks like :

Code: [Select]
toolbar: {
            items: [{
                            type: 'button',
                            label: "Export",
                            icon: 'ui-icon-arrowthickstop-1-s',
                            listener: function () {

                            //filter the selected rows.
                            this.filter({
                                mode: 'AND',
                                oper: 'replace',
                                rules: [{dataIndx: 'state', condition: 'equal', value: true}]
                            });

                            var format = 'xlsx',
                            blob = this.exportData({
                                format: format
                                render: true
                            });
                            if(typeof blob === "string"){
                                blob = new Blob([blob]);
                            }
                            saveAs(blob, "pqGrid."+ format );
                    }
                }
            ]
        }

But still when i click on export, it downloads all the data from grid not the selected row.

Also it hits the server URL to get data. Although I've not used URL parameter in exportData() method. Why it is going to server and why there is all rows in exported excel instead of selected ones.

Please help me in this.

Many thanks in advance.

13
Help for ParamQuery Pro / Re: How to export selected rows from grid
« on: June 09, 2018, 11:48:42 am »
Hi,

Thanks for your reply but when i do that i got error shown in screenshot.

Please advice.

Thanks

14
Help for ParamQuery Pro / How to export selected rows from grid
« on: June 06, 2018, 07:01:39 pm »
Hi,

I am using PqGrid pro version 5.1.0

I want to export selected rows in excel but when i click on Export button, it always download all rows.

I've followed this link

https://paramquery.com/forum/index.php?topic=1524.msg6616#msg6616

to filter the selected rows only but did not get success.

My code is:

Code: [Select]
var $grid = jQuery("#grid_json");
jQuery(document).ready(function(){
    var gridheight = 600;
   
    var pqVS = {
        rpp: 100, //records per page.
        init: function () {
            this.totalRecords = 0;
            this.requestPage = 1; //begins from 1.
            this.data = [];
        }
    };
   
    pqVS.init();
   
    //define common ajax object for addition, update and delete.
    var ajaxObj = {
        dataType: "JSON",
        beforeSend: function () {
            this.showLoading();
        },
        complete: function () {
            this.hideLoading();
        },
        error: function () {
            this.rollback();
        }
    };
   
    var obj = {
        hwrap: false,
        rowBorders: false,
        autoRow: false,
        rowHt: 35,
        trackModel: { on: true }, //to turn on the track changes.
        numberCell: {show: false},
        toolbar: {
            items: [{
                type: 'button',
                label: "Export",
                icon: 'ui-icon-arrowthickstop-1-s',
                listener: function () {
                    /*
                    var ids = this.SelectRow().getSelection().map(function(rowList){
                    return rowList.rowData.ProductID;
                })
               
                alert(ids);
                */
               
                //filter the selected rows.
                $grid.filter({
                    mode: 'AND',
                    oper: 'replace',
                    data: [{dataIndx: 'state', condition: 'equal', value: true}]
                });
               
               
                var format = 'xlsx',
                blob = this.exportData({
                    //url: "http://local.pims/export/exportdata",
                    format: format,
                    render: true
                });
                if(typeof blob === "string"){
                    blob = new Blob([blob]);
                }
                saveAs(blob, "pqGrid."+ format );
               
                //reset the filter.
                $grid.filter({
                    oper: 'replace',
                    data: []
                })
            }
        }
    ]
},
rowSelect: function (evt, ui) {
    var str = JSON.stringify(ui, function(key, value){
        if( key.indexOf("pq_") !== 0){
            return value;
        }
    }, 2)
    $("#rowSelect_pre").html(str);
},

title: "<b>Export Products</b>",
postRenderInterval: -1, //synchronous post render.
swipeModel: { on: false },
selectionModel: { type: 'cell' },
filterModel: { on: true, header: true, type: 'remote' },
resizable: true,
virtualX: true,
virtualY: true,
load: function (evt, ui) {
    var grid = this,
    data = grid.option('dataModel').data;
    grid.widget().pqTooltip(); //attach a tooltip.
},
editable: true,
create: function (evt, ui) {
    this.widget().pqTooltip();
},
sortModel: { type: 'remote', sorter: [{ dataIndx: 'company', dir: 'up'}] },
beforeSort: function (evt) {
    if (evt.originalEvent) {//only if sorting done through header cell click.
        pqVS.init();
    }
},
beforeTableView: function (evt, ui) {
    var initV = ui.initV,
    finalV = ui.finalV,
    data = pqVS.data,
    rpp = pqVS.rpp,
    requestPage;
   
    if (initV != null) {
       
        //if records to be displayed in viewport are not present in local cache,
        //then fetch them from remote database/server.
       
        if (data[initV] && data[initV].pq_empty) {
            requestPage = Math.floor(initV / rpp) + 1;
        }
        else if (data[finalV] && data[finalV].pq_empty) {
            requestPage = Math.floor(finalV / rpp) + 1;
        }
       
        if (requestPage >= 1) {
            if (pqVS.requestPage != requestPage) {
               
                pqVS.requestPage = requestPage;
               
                //initiate remote request.
                this.refreshDataAndView();
            }
        }
    }
}
};

obj.dataModel = {
    dataType: "JSON",
    location: "remote",
    recIndx: "ProductID",
    url: "http://mydemo.com/export/getproductsbyajax",
    postData: function () {
        return {
            pq_curpage: pqVS.requestPage,
            pq_rpp: pqVS.rpp
        };
    },
    getData: function (response) {
        var data = response.data,
        totalRecords = response.totalRecords,
        len = data.length,
        curPage = response.curPage,
        pq_data = pqVS.data,
        init = (curPage - 1) * pqVS.rpp;
       
        if (!pqVS.totalRecords) {
            //first time initialize the rows.
            for (var i = len; i < totalRecords; i++) {
                pq_data[i + init] = { pq_empty: true };
            }
            pqVS.totalRecords = totalRecords;
        }
        for (var i = 0; i < len; i++) {
            pq_data[i + init] = data[i];
            pq_data[i + init].pq_empty = false;
        }
        return { data: pq_data }
    },
    error: function (jqXHR, textStatus, errorThrown) {
        console.log(errorThrown);
    }
};

obj.colModel = [
    {
        dataIndx: "state",
        align: "center",
        "width": "165",
        title: "<label><input type='checkbox' />&nbsp;Select All</label>",
        cb: { header: true, select: true, all: true },
        type: 'checkbox',
        cls: 'ui-state-default',
        dataType: 'bool',
        editor: false
    }
    ,{
        "title": "Column 1",
        "width": "165",
        "editable": false,
        "dataIndx": "catAttr_8",
        "filter": {
            "type": "textbox",
            "condition": "begin",
            "listeners": ["change"]
        },
        "editor": {
            "type": "textbox"
        }
    }
    ,{
        "title": "Column 2",
        "width": "165",
        "editable": false,
        "dataIndx": "catAttr_3",
        "filter": {
            "type": "textbox",
            "condition": "begin",
            "listeners": ["change"]
        },
        "editor": {
            "type": "textbox"
        }
    }
   
   
];

$grid.pqGrid(obj);
$grid.pqGrid( "option", "height", gridheight );

});

Please let me know what i am doing wrong here.

Thanks

15
Hi,

Many Many thanks to you to figure out the issues.

I'll follow your instructions and try not to push rows in data as i was not aware that it can create such problems.


Pages: [1] 2