Answered: Formatting a textfield when record loaded

When I click on a row in a grid I load my form. I want to format this textfield as US dollars so I do a little routine. My problem is ...

a) If I use "setValue" .. I get an error message about "too much recursion" as soon as I click my row and the value is changed.

b) If I use "setRawValue" .. my formatted output is correct the first time I load a record. If I click on a new row and some of that data matches the previous data .... those that match are shown without the formatting. The non-matching data appears correctly with formatting.

I wasn't sure how to do what you're wanting actually so I took a look and below is what I came up with. If you extend textfield you can potentially just do setValue() (see the source for datefield) and get what you're after, though I wouldn't use my code below for production - I didn't test it too much and there's probably some validation that needs to happen.

When I click through the grid there are values that stay the same, so the "change" event isn't being fired. Okay, I get that. Should I listen for a different event? I'm loading the records into the form when the row is clicked as seen below:

Also ... IE9 completely freaks out on the load. The value shows correctly and then quickly is changed to zero and all the value flicker. I guess the values are being loaded over and over again to give that effect.

I wasn't sure how to do what you're wanting actually so I took a look and below is what I came up with. If you extend textfield you can potentially just do setValue() (see the source for datefield) and get what you're after, though I wouldn't use my code below for production - I didn't test it too much and there's probably some validation that needs to happen.

I demo my app today and found 1 to 2 second delay from the time I select a row in my grid to the time the fields actually got populated. I was able to switch all of my textfield to you dollarfield and that works GREAT. Lightening fast!

I still have about 6 fields that are xtype : 'box' that I need to update text in. I have them all comment out and it's flying. The minute I uncomment one of these fields out, I go back to that noticable delay. It gets worse with each line of code I introduce.