Author Topic: Prevent from adding new rows when pasting data.  (Read 3385 times)

p38

  • Newbie
  • *
  • Posts: 2
    • View Profile
Prevent from adding new rows when pasting data.
« on: September 07, 2021, 03:48:55 am »
Is there anyway to block pqgrid from adding new rows if they paste a number of rows greater than current rowcount?

I find that pasting data inserts extra row if the paste data is more then the row count.

eg: if I have 10 rows and I paste 15 rows, pqgrids adds another 5 rows. 

I cant find anywhere a setting to limit adding new rows.

for example a maxRowCount and maxColCount would be handy to have, if set, wont allow pqgrids to add more rows/columns than these values.

Many thanks.
« Last Edit: September 07, 2021, 04:10:19 am by p38 »

p38

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Prevent from adding new rows when pasting data.
« Reply #1 on: September 10, 2021, 09:54:07 pm »
Hi Admin, any feedback perhaps?

I am of the opinion this is a bug, if one sets the max rows, and you try and paste more than the max rows, it should not allow this, or alternatively there should be a setting to allow this.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6392
    • View Profile
Re: Prevent from adding new rows when pasting data.
« Reply #2 on: April 29, 2025, 10:57:16 pm »
Sorry for late reply.

It can be done in beforeValidate, check if ui.source == 'paste' and there are objects of type: 'add' in ui.rowList, then remove them.

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