Ayesha
Ayesha

Reputation: 11

Is there any event like itemEditEnding or any other way to stop event before itemEditEnd event in datagrids of Flex 4?

I have editable grids which are 2-way binded to my model. What I want is to validate my data when user edits any cell before it get updated in model. I have applied my validation at ItemEditEnd handler, but, I want to apply validation in between itemEditBegin and itemEditEnd events.

any ideas how to achieve this?

Upvotes: 1

Views: 229

Answers (1)

Jason Towne
Jason Towne

Reputation: 8050

For this level of validation I would create a Validator for the type of data you're editing (string, number, etc.) and set the Validator's trigger to the change event of your itemEditor component.

Check out Adobe's example on using validators in an itemEditor for more info.

Update:

You may also want to check out this related question.

"In your event listener, you can examine the data entered into the item editor. If the data is incorrect, you can call the preventDefault() method to stop Flex from passing the new data back to the list-based control and from closing the editor."

Upvotes: 1

Related Questions