Author Topic: Pasted Data Not Reflecting in Empty Grid  (Read 2385 times)

Sivakumar

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 32
    • View Profile
Pasted Data Not Reflecting in Empty Grid
« on: January 06, 2021, 04:18:49 pm »
Hi Paramvir,

https://paramquery.com/pro/demos62/copy_paste

I'm following the above mentioned demo to  :

copy one or more rows from excel and then pasting it in a grid with 9 columns(colModel defined)
then I want to save those pasted rows using the addList.

However, the pasted rows are not getting reflected in the grid and is giving the below error message on console:

Code: [Select]
Uncaught TypeError: f.forEach is not a function
    at t.<computed>.<computed>.a._digestData (pqgrid.min.js:10)
    at i.cExcel.paste (pqgrid.min.js:14)
    at pqgrid.min.js:14

I'm getting the pasted rows information in the beforePaste event in an array.

Unable to generate a jsfiddle as all jsfiddle example is showing $ undefined error.

Thanks,
-Uttam


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: Pasted Data Not Reflecting in Empty Grid
« Reply #1 on: January 06, 2021, 06:08:04 pm »
I'm able to paste rows from Excel in empty grid B of that demo without error.

you may share a stackblitz if you are facing difficulty with jsfiddle.

https://stackblitz.com/edit/paramquery-demo

Sivakumar

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Pasted Data Not Reflecting in Empty Grid
« Reply #2 on: January 06, 2021, 10:11:10 pm »
Hi,

Please check the jsfiddle below, managed to get one  ;)

https://jsfiddle.net/k8gfrwd1/1/

The pasted rows are now reflecting in the empty grid.
However, the isDirty flag is not changing to true and thus I'm unable to save the values in the database with the SaveChargeCodeManager method.

How can this be done?
Is there any other way through which I can save the pasted values from the empty grid to the database?

Thanks,
-Uttam

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: Pasted Data Not Reflecting in Empty Grid
« Reply #3 on: January 07, 2021, 12:49:45 pm »
It's necessary to choose one of the columns as primary key i.e., dataModel.recIndx

Example: https://paramquery.com/pro/demos/editing_batch

Sivakumar

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Pasted Data Not Reflecting in Empty Grid
« Reply #4 on: January 07, 2021, 01:11:43 pm »
Hi,

I want the grid to be like a workspace, i.e., I'll be pasting the data after copying it from excel and then saving those data in the database.
Once those values get saved, I want the grid to be empty or blank again.

Will recIndx work in this scenario where I don't want to fetch any data and display in the grid?
All I want it for pushing records into the database.

Thanks,
-Uttam

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: Pasted Data Not Reflecting in Empty Grid
« Reply #5 on: January 07, 2021, 02:02:55 pm »
In that case you don't need batch editing and dirty flag.

you can post whole data in grid i.e, dataModel.data to the database.