The data provider for the grid is "masters" an ArrayCollection.  The
form uses "master" which is an Object.  I had to include the
Number(txtMasterRate.text) in the Binding or I get the type coercion
error when trying to save back to the database.  It almost works - when
I make an entry in the form, the grid is updated.  But trying to enter a
decimal causes weird behavior - it backspaces and clears the previous
entry. (No - it's not my keyboard)   Is there another approach to use?



The datagrid looks like this:

<mx:DataGrid id="dgMasterStatus" editable="true"
dataProvider="{masters}" width="457" change="mastersChange()"
valueCommit="mastersChange()">

<mx:columns>

<mx:DataGridColumn headerText="Rate" width="120" dataField="masterRate"
>

</mx:DataGridColumn>

</mx:columns>

</mx:DataGrid>

======================================

Then the form looks like this:

<mx:Form width="264" >

<mx:FormItem label="Rate">

<mx:TextInput id="txtMasterRate" text="{master.groupRate}" >



</mx:TextInput>

</mx:FormItem>

============================

And the Binding looks like this:

<mx:Binding source="Number(txtMasterRate.text)"
destination="revmaxmaster.masterRate" />










--- In flexcoders@yahoogroups.com, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> The form should update the dataprovider that the datagrid is using.
Are
> you set up that way? What does the binding look like?
>
>
>
> ________________________________
>
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
On
> Behalf Of headjoog
> Sent: Thursday, June 14, 2007 12:12 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: Number column in DataGrid
>
>
>
> Nope - same results. I think the <mx:Binding> is causing the weird
> behavior. If I take it out, I can type numbers with decimals in the
> <mx:TextInput> item. But with it in there, it won't allow any
> decimals.
>
> --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com>
> , "Doug Lowder" douglowder@
> wrote:
> >
> > Top-level function parseFloat() might do the trick. You may need
> to
> > pass it a substring if your text input has a leading currency
> > character.
> >
> > --- In flexcoders@yahoogroups.com
> <mailto:flexcoders%40yahoogroups.com> , "headjoog" <jburns@> wrote:
> > >
> > > I'm stuck and making a dunce appeal - this can't be as difficult
> as
> > I'm
> > > making it:
> > >
> > > I have a Data Grid and a Form. When an item is selected on the
> > Data
> > > Grid, it displays the selected item on the Form for editing.
> > >
> > > I'm using <mx:Binding> so changes on the form are reflected in
> the
> > > grid. With straight text values, life is good - it works fine.
> > >
> > > One column in the grid is a Number (actually currency) and when I
> > try
> > > to include that I get a type coercion error. (I'm saving this
> back
> > to a
> > > database via Hibernate where the column is a number). I tried to
> > use
> > > Number(txtInput.text) in the <mx:Binding> "destination" tag and
> it
> > > works, but I lose precision on the Number - it won't save
> > decimals. It
> > > acts weird - when I type a decimal, it takes it, then backs it
> out
> > if I
> > > type more numbers.
> > >
> > > I'm stuck on this conversion of the TextInput to a Number. Do
> you
> > have
> > > to convert the <TextInput> to a Number via a function? Can
> someone
> > > clue me in?
> > >
> > > Thanks -joe
> > >
> >
>


Reply via email to