[flexcoders] change decimal separator to comma on input field
Hi, I am banging my head for a couple of hours with this problem and i'm drawing a blank. Please anyone for some help on this subject.. I have a form which is updating mysql table with one of the columns named 'price' with data type decimal(5,2). In flex i used php service generator to create php for crud db operations. Everything works except i cannot enable input with decimal symbol comma instead of dot. valueObjects:Products id=products price={parseFloat(priceTextInput.text)} / mx:NumberFormatter id=euroPriceInput precision=2 rounding=none decimalSeparatorFrom=, decimalSeparatorTo=. useThousandsSeparator=false / mx:TextInput id=priceTextInput text={euroPriceInput.format(products.price)} width=200/ If I type price in format 12.34 it updates correctly but when I use 12,34 it saves 12,00. Use of numberformatter does not make a difference. What am I missing? Thank you in advance. -- View this message in context: http://www.nabble.com/change-decimal-separator-to-comma-on-input-field-tp25780609p25780609.html Sent from the FlexCoders mailing list archive at Nabble.com.
Re: [flexcoders] change decimal separator to comma on input field
Thank you, that helped me a lot. On the end I used number formatting in update button click handler just before the update part happens. I tried valuecommit event but its firing all the time because the same input gets populated from database when item in datagrid is selected. seanmcmonahan wrote: Try listening for TextInput's valueCommit event. In you event handler do the number formatting. --- In flexcoders@yahoogroups.com, awesome cubesp...@... wrote: Hi, I am banging my head for a couple of hours with this problem and i'm drawing a blank. Please anyone for some help on this subject.. I have a form which is updating mysql table with one of the columns named 'price' with data type decimal(5,2). In flex i used php service generator to create php for crud db operations. Everything works except i cannot enable input with decimal symbol comma instead of dot. valueObjects:Products id=products price={parseFloat(priceTextInput.text)} / mx:NumberFormatter id=euroPriceInput precision=2 rounding=none decimalSeparatorFrom=, decimalSeparatorTo=. useThousandsSeparator=false / mx:TextInput id=priceTextInput text={euroPriceInput.format(products.price)} width=200/ If I type price in format 12.34 it updates correctly but when I use 12,34 it saves 12,00. Use of numberformatter does not make a difference. What am I missing? Thank you in advance. -- View this message in context: http://www.nabble.com/change-decimal-separator-to-comma-on-input-field-tp25780609p25780609.html Sent from the FlexCoders mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/change-decimal-separator-to-comma-on-input-field-tp25780609p25795741.html Sent from the FlexCoders mailing list archive at Nabble.com.
[flexcoders] advanced datagrid refresh
When I press delete I need to refresh datagrid to display changes. Currently it displays changes only when I reload the page. I tried getAllItemsCollection.refresh(); but it only collapses grouping and does not display changes. For testing purposes I created delete button and tried everything from invalidatedisplaylist to reassigning dataprovider but with no luck. Any help would be appreciated. My code: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=vertical minWidth=1024 minHeight=768 xmlns:izdelkiservice=services.izdelkiservice.* mx:Script ![CDATA[ import mx.events.AdvancedDataGridEvent; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.DataGrid; import mx.events.DataGridEvent; import mx.messaging.AbstractConsumer; import mx.utils.ObjectUtil; import mx.events.FlexEvent; import mx.controls.Alert; public var clickedColumn:String; protected function adg_creationCompleteHandler(event:FlexEvent):void { getAllItemsResult.token = izdelkiService.getAllItems(); } protected function button_clickHandler(event:MouseEvent):void { createItemResult.token = izdelkiService.createItem(izdelek); } protected function updateBtn_clickHandler(event:MouseEvent):void { updateItemResult.token = izdelkiService.updateItem(izdelek2); } protected function deleteBtn_clickHandler(event:MouseEvent):void { deleteItemResult.token = izdelkiService.deleteItem(izdelek2.id); getAllItemsCollection.refresh(); adg.dataProvider = adg.dataProvider; } private var _dataField:String; private function adg_headerReleaseHandler(event:AdvancedDataGridEvent):void { clickedColumn = event.dataField; } private function sortNumeric(obj1:Object, obj2:Object):int { return ObjectUtil.numericCompare(obj1[clickedColumn],obj2[clickedColumn]); } private function sortKat(obj1:Object, obj2:Object):int { return ObjectUtil.numericCompare(obj1.kat,obj2.kat); } protected function refreshBtn_clickHandler(event:MouseEvent):void { adg.dataProvider = null; adg.dataProvider = {getAllItemsCollection}; getAllItemsCollection.refresh(); adg.validateDisplayList(); adg.validateNow(); adg.invalidateDisplayList(); adg.invalidateList(); } ]] /mx:Script mx:AdvancedDataGrid id=adg designViewDataType=tree width=100% creationComplete=adg_creationCompleteHandler(event) editable=false dataProvider={getAllItemsCollection} height=50% headerRelease=adg_headerReleaseHandler(event) mx:columns mx:AdvancedDataGridColumn headerText=id dataField=id editable=false sortCompareFunction=sortNumeric/ mx:AdvancedDataGridColumn headerText=izdelek dataField=izdelek/ mx:AdvancedDataGridColumn headerText=ime dataField=ime/ mx:AdvancedDataGridColumn headerText=kat dataField=kat sortCompareFunction=sortNumeric/ mx:AdvancedDataGridColumn headerText=opis dataField=opis/ mx:AdvancedDataGridColumn headerText=datum dataField=datum/ mx:AdvancedDataGridColumn headerText=vrstni_red dataField=vrstni_red sortCompareFunction=sortNumeric/ /mx:columns /mx:AdvancedDataGrid mx:CallResponder id=getAllItemsResult result=getAllItemsCollection.refresh();/ izdelkiservice:IzdelkiService id=izdelkiService destination=IzdelkiService