Author Topic: Handling of quotes in ParamQuery Pro 4.0.2  (Read 2663 times)

rgkeenan

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 6
    • View Profile
Handling of quotes in ParamQuery Pro 4.0.2
« on: November 16, 2017, 12:25:15 am »
 Great job fixing copy and paste of newlines within cells!

Unfortunately, we still have an issue that's proving difficult to work around.

Using ParamQuery Pro 4.0.2:

We have a table that contains single line values with quotes in them, ie:

  1"x2" Sealed  Lamp Kit with Base Mount and Pigtail

When we copy these values from ParamQuery, then paste them into another ParamQuery grid, what's in the ui.rows array in our beforePaste function is:

0:["1x2 Sealed  Lamp Kit with Base Mount and Pigtail"]

The quotes are gone.

Also, when pasting thousands of cells, multiple rows get combined.

For instance, when pasting a single column copied from an identical grid, 4484 rows becomes 4134 rows, with some cells containing values that belong in several other rows.

When pasted into a text editor, the data in the clipboard looks identical to what's in the grid, with one line per value, quotes preserved as-is, but when it's pasted into PQ the quotes are gone and lines are concatenated.

Any idea of a fix?

ParamQuery has become an important part of our development cycle for WordPress, one that we're committed to developing solutions around. We're already using it behind-the-scenes for development and data migration. Overall, it's superior to most of the grid editors on the market today.

This is the one remaining issue that prevents us from presenting it to clients as a bulk editing tool for a variety of other use-cases in WordPress.

Thanks in advance!

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6296
    • View Profile
Re: Handling of quotes in ParamQuery Pro 4.0.2
« Reply #1 on: November 16, 2017, 10:28:34 pm »
Please try this patch and let me know whether it fixes the issue faced by you.

Code: [Select]
$.paramquery.cExcel.prototype.getRows=function(e){return e=e.replace(/\n$/,""),(e=e.replace(/(^|\t|\n)"(?=[^\t]*?[\r\n])([^"]|"")*"(?=$|\t|\n)/g,function(e){return e.replace(/(\r\n|\n)/g,"\r").replace(/^(\t|\n)?"/,"$1").replace(/"$/,"").replace(/""/g,'"')})).split("\n")};

rgkeenan

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Handling of quotes in ParamQuery Pro 4.0.2
« Reply #2 on: November 17, 2017, 09:28:03 pm »
Thanks for the quick response!

This works great for single-line fields, but when I copy-and-paste fields containing newlines, PQ always sees them as changes - even if I copy a single field and paste it into itself, which means a lot of unnecessary writing to the database.

Should we be standardising on a specific convention for newlines so it matches what PQ uses? "\r\n", "\r", "\n"?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6296
    • View Profile
Re: Handling of quotes in ParamQuery Pro 4.0.2
« Reply #3 on: November 17, 2017, 10:46:18 pm »
change detection for multi lines would be checked and addressed separately.

Could you please confirm whether the patch fixes the issue mentioned in your first post.
« Last Edit: November 19, 2017, 05:04:46 pm by paramquery »

rgkeenan

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Handling of quotes in ParamQuery Pro 4.0.2
« Reply #4 on: November 20, 2017, 07:28:26 pm »
Sorry if I wasn't clear about that. Yes, the patch worked perfectly for the issue with quotes.