Author Topic: reg. pasteModel type append not working.  (Read 434 times)

mraj

  • Newbie
  • *
  • Posts: 46
    • View Profile
reg. pasteModel type append not working.
« on: March 15, 2024, 02:13:26 pm »
Hi

I am using paste model option

pasteModel: { on: true, type: "append" }.

And, When tried to paste from excel which is having more rows than the rows present in the grid. it is not properly pasting.

what is the exact settings for appending the rows.


mraj

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: reg. pasteModel type append not working.
« Reply #1 on: March 15, 2024, 02:46:06 pm »
It is working.  but in the application, with the below condition.(added for editable )

 title: "Back Details", halign: "center", colModel: [
                            {
                                title: "Name (Based on Pressure)", dataIndx: "back_name", dataType: "string", align: "left", halign: "center", width: 350,
                                editable: function (ui) {
                                    return (ui.rowData.ahead_back_same == "no");
                                },


when date is pasted,(rows more than existing rows in the grid ). getting error.

for ex: if i 10 records in the grid, and , if i paste 20 records from 5th position, it loops upto tenth row. after that getting error.

If i put simply false for the condition  return (ui.rowData.ahead_back_same == "no");, loosing the editable option. but able to copy. all the 20 records.

mraj

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: reg. pasteModel type append not working.
« Reply #2 on: March 18, 2024, 08:50:47 am »
Hi,
expecting any reply, which will be helpful. When the data is copied from excel having more  rows than the rows (empty rows)  present in the grid, with the above editable condition. getting error. please explain how it works internally. or suggest any workaround for it.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6260
    • View Profile
Re: reg. pasteModel type append not working.
« Reply #3 on: March 19, 2024, 11:36:51 am »
rows/cells are supposed to be editable for paste to work.

You can set editable to true in beforeValidate event when ( ui.source == 'paste' ) and reset the editable back to initial value in change event.

https://paramquery.com/api#event-beforeValidate

mraj

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: reg. pasteModel type append not working.
« Reply #4 on: March 19, 2024, 05:57:54 pm »
The problem is, if i copy lesser rows than the grid rows. that case even if editable=false , it is working. If i paste more rows than the grid rows. i am getting error as that editable condition is not defined.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6260
    • View Profile
Re: reg. pasteModel type append not working.
« Reply #5 on: March 20, 2024, 04:23:36 pm »
Works fine in the example. https://paramquery.com/demos/copy_paste

Kindly share a jsfiddle if still facing issues.

mraj

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: reg. pasteModel type append not working.
« Reply #6 on: March 22, 2024, 12:14:33 pm »
Thanks for the reply. will try further.