Author Topic: Negative Number Support  (Read 3953 times)

mlyons

  • Newbie
  • *
  • Posts: 7
    • View Profile
Negative Number Support
« on: February 03, 2017, 01:27:47 am »
If I set the DataType on the ColumnModel to float it won't let me enter negative numbers.  Is there a way around this without using RegEx?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Negative Number Support
« Reply #1 on: February 03, 2017, 10:30:19 pm »
negative numbers can be entered when dataType is either "float" or "integer".

Example: Freight column in https://paramquery.com/demos/editing_custom

Just remove the validation:
Code: [Select]
validations: [{ type: 'gte', value: 1, msg: "should be >= 1"}],

mlyons

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Negative Number Support
« Reply #2 on: February 04, 2017, 01:02:16 am »
The issue isn't only the validation.  If I want to enter "-100",  I have to enter in the "100" and then backspace to the beginning and add the "-".  I can't start out by typing the "-" first.  Is there a way around this?

mlyons

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Negative Number Support
« Reply #3 on: February 08, 2017, 08:37:56 pm »
Is this the expected behavior with your grid?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Negative Number Support
« Reply #4 on: February 08, 2017, 09:38:10 pm »
You may need to upgrade to v2.2.0

I can enter "-" first in Freight column in this example: https://paramquery.com/demos/editing_custom

mlyons

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Negative Number Support
« Reply #5 on: February 14, 2017, 10:42:31 am »
RESOLVED - with upgrade

I found that with the free version of the grid, I could enter the negative if I typed fast.  If I hit the "-" and then waited a breath before typing a numeral it removed the negative.  If I typed fast enough it worked.

We upgraded to the pro version and with no code changes everything started working correctly as in your demos.

Roaming

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Negative Number Support
« Reply #6 on: April 15, 2017, 01:18:32 pm »
That's a peculiar phenomenon. I haven't encountered. Negative number is also normally appearence.Could you copy your code here?