ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: rgorantla on September 23, 2014, 08:41:10 pm

Title: Excel Copy Paste Error
Post by: rgorantla on September 23, 2014, 08:41:10 pm
Hi,

First time when you copy and paste multiple rows and columns it is working fine.
When you click addnewrow - and try to paste i am receivign an error

"Uncaught primary key violation"
Title: Re: Excel Copy Paste Error
Post by: paramvir on September 24, 2014, 12:03:12 am
This error is thrown when there is a duplicate value of primary key in a grid.

Please point out in which demo do you get this error?
Title: Re: Excel Copy Paste Error
Post by: rgorantla on September 26, 2014, 07:21:26 pm
Sorry, that was my mistake - i put recIndx as name and trying to copy paste same names- So was receiving this error.

But have another issue -

I have no rows , clicked on add new row - 3 times - i have 3 rows now.
Copied just 1 row in excel and tied to paste it - instead of pasting it in 1 row , it is pasting in all rows.

I did change add row function : because we just want to select the cell  not to go to edit mode. - Could you please help me on whats am i doing wrong
{
                    type: 'button', icon: 'ui-icon-plus', label: 'New Plan', listener:
                      {
                          "click": function (evt, ui) {
                              //append empty row at the end.                           
                              var rowData = {};// UnitPrice: 1, ProductID: 34, UnitPrice: 0.2 }; //empty row
                              var rowIndx = $grid.pqGrid("addRow", { rowData: rowData, checkEditable: true });
                              $grid.pqGrid("goToPage", { rowIndx: rowIndx });
                              //  $grid.pqGrid("editFirstCellInRow", { rowIndx: rowIndx });
                              $grid.pqGrid("setSelection", { rowIndx: rowIndx, colIndx: 1 });
                          }
                      }
                }
Title: Re: Excel Copy Paste Error
Post by: paramvir on September 30, 2014, 10:32:21 pm
It's because of the selection. Paste takes place in all the selected rows or in rows having first selected cell.
Title: Re: Excel Copy Paste Error
Post by: rgorantla on September 30, 2014, 10:38:25 pm
No, its happenign even if i dotn have setselection

  var rowIndx = $grid.pqGrid("addRow", { rowData: rowData, checkEditable: true });
                            //  console.log(rowIndx);
                              $grid.pqGrid("goToPage", { rowIndx: rowIndx });
                              $grid.pqGrid("editFirstCellInRow", { rowIndx: rowIndx });
Title: Re: Excel Copy Paste Error
Post by: paramvir on September 30, 2014, 10:43:41 pm
I don't see this happening in this demo (which has same code )

http://paramquery.com/pro/demos/editing_instant
Title: Re: Excel Copy Paste Error
Post by: rgorantla on September 30, 2014, 11:12:11 pm
It is happenign in your demo too.

Click on add new product : and try to paste some values (lets say row 19)

and then click add new row again (rows  20,21) for mutliple times or once- since it is in edit mode - do a escape button to come out of that cell and paste - it is pasting in the the row 19 not in 20,21
Title: Re: Excel Copy Paste Error
Post by: paramvir on October 01, 2014, 12:03:06 am
Paste takes place only on the contiguous selected rows / cells.

If row 19 is selected, paste would take place on row 19 even if you add new rows i.e. 20, 21, etc.
Title: Re: Excel Copy Paste Error
Post by: rgorantla on October 01, 2014, 12:29:15 am

Though we are on row 22 ,click escape button - doesnt it should select that paricular row (22)? isntead of 19 ?

I need to click twice or thrice to select roww 22 inorder to paste
Title: Re: Excel Copy Paste Error
Post by: paramvir on October 01, 2014, 01:05:13 am
if you want selections to remain in sync with newly added row, please use setSelection as shown in this demo

http://paramquery.com/pro/demos/editing_instant
Title: Re: Excel Copy Paste Error
Post by: rgorantla on October 01, 2014, 06:15:33 am
Thanks , that worked.