PDA

View Full Version : Proper Way To Set CellEdit Value Format For numberfield in ExtJS 4.0.7



rkanemeier
24 Sep 2013, 8:41 AM
I am struggling with a way to force formatting on an editable cell using the cellediting grid plugin. The store value for the cell is 170.00. When the cell is opened for edit, the value is 170. When you press tab or enter, the app thinks the value has changed from 170.00 to 170. How do I configure my app so that the cellediting plugin has the same format as the store/grid? The following code does not seem to work:

How do you embed fiddle code/page?

rkanemeier
25 Sep 2013, 6:08 AM
(was trying to edit my post and accidentally replied).

ettavolt
27 Sep 2013, 11:26 AM
I believe you are using 'string' or 'auto' fields in your model. Try to change field type to 'float' and use numbercolumn (don't forget about format (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.grid.column.Number-cfg-format)) for displaying them.

Fiddles are inserted with [fiddle] (http://www.sencha.com/forum/misc.php?do=bbcode) tag.

rkanemeier
27 Sep 2013, 11:56 AM
You nailed it. I was using nothing in my model. It defaulted a value of 0.00 to a string. Weird. I changed it to float and everything worked fine!