And if I omit preventDefault, the invalid value remains, but the red focus ring turns blue. I've also established that setting editedItemPosition creates a new item editor (as I would expect), so I can't store and access a "valid" flag in the item editor component. Is there some other way to prevent an invalid field from losing focus? Or to restart the edit with the invalid value and have it re-validate?
On Nov 28, 2007 1:51 PM, Richard Rodseth <[EMAIL PROTECTED]> wrote: > That keeps(restores) the focus, but also restores the pre-edit value. > > > On Nov 28, 2007 1:20 PM, Alex Harui <[EMAIL PROTECTED]> wrote: > > > IIRC, the pattern is to call preventDefault and then set > > editedItemPosition to the current position. > > > > ------------------------------ > > *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On > > Behalf Of *Richard Rodseth > > *Sent:* Wednesday, November 28, 2007 12:20 PM > > *To:* flexcoders@yahoogroups.com > > *Subject:* [flexcoders] itemEditEnd preventDefault > > > > I have an item renderer/editor that does as-you-type validation using > > standard Flex validators, and updates a "valid" property in the data. I wish > > to prevent the edit from ending if the data is valid. > > > > When tabbing, the following works in column one, but not in column two > > (the last editable column): > > > > private function handleItemEditEnd(event : DataGridEvent) : void { > > > > if (event.itemRenderer.data.valid) { > > > > // do some stuff > > > > } else { > > > > event.preventDefault(); > > > > } > > > > > > Any ideas? Also, does the renderer get any access to this event? If I > > want to move "valid" from the data to the renderer itself, I suppose I would > > have to cast event.itemRenderer above to my renderer type, and call a > > method or access a property. > > > > > > Thanks. > > > > > > > >