Author Topic: How to paste a numerical value including thousand separator  (Read 5034 times)

pq33user

  • Newbie
  • *
  • Posts: 11
    • View Profile
How to paste a numerical value including thousand separator
« on: September 05, 2018, 02:25:37 pm »
Hi.

When pasting numerical values including ","(Thousand separator), value after "," can not be pasted.
Is there a solution?

Thanks in advance.


e.g.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: How to paste a numerical value including thousand separator
« Reply #1 on: September 07, 2018, 12:40:01 pm »
beforePaste event is used for this purpose.

https://paramquery.com/pro/api#event-beforePaste

pq33user

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: How to paste a numerical value including thousand separator
« Reply #2 on: September 07, 2018, 01:46:36 pm »
Thank you.
In https://paramquery.com/pro/demos/infinite_scroll it was solved by adding the following code after beforeTableView.

Code: [Select]
beforePaste: function(evt, ui){
    //sanitize pasted data.
    var CM = this.getColModel(),
        rows = ui.rows,
        area = ui.areas[0],
        c1 = area.c1;

    for(var i=0; i<rows.length; i++){
        var row = rows[i];
        for(var j=0; j<row.length; j++){
            var column = CM[j+c1],
                dt = column.dataType;
            if( dt == "integer" || dt == "float" ){

                row[j] = row[j].replace(/\,/g,"");
            }
        }
    }
}

v3.3.0-3.4.x does not have beforePaste.
Is there an Events that can be used instead?
There was no areas in ui of beforeValidate.

pq33user

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: How to paste a numerical value including thousand separator
« Reply #3 on: October 10, 2018, 11:46:08 am »
Hi.

I decided to upgrade PQGrid used in my project from v3.3.0 to v5.1.0.

Thank you for your support.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: How to paste a numerical value including thousand separator
« Reply #4 on: October 10, 2018, 11:50:18 am »
This board is for evaluation users.

Please share your Pro credentials so that your account can be upgraded.

pq33user

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: How to paste a numerical value including thousand separator
« Reply #5 on: October 10, 2018, 01:28:08 pm »
OK.
I confirmed it within the company that I already registered Pro license to another user ID.
Next time I will "Help for ParamQuery Pro" to use Pro license user to ask.