I'm doing something like that right now for the individual cells. I've integrated a validator into the cell object. However, I need to be able to validate the complete datagrid when the save button is pressed. If the user never moves to a cell, I can't use the itemEditEnd to validate, I need to move through the data and check. Using the itemEditor.newInstance() and calling my validation routine, I can detect that a validation fails. Now I'm going to try to use the itemRenderer property to indicate the nice red boxes.
John --- In flexcoders@yahoogroups.com, "Roman Protsiuk" <[EMAIL PROTECTED]> wrote: > > I remember I did it like this: > > public class FilesDataGridColumnEditor extends TextInput { > > public function SomeDataGridEditor() { > _validator.source = this; > _validator.triggerEvent = "change"; > _validator.required = true; > _validator.property = "text"; > } > > private var _validator : Validator = new SomeValidator(); > } > > It's not "the best practices", but as far as I remember it worked. :) > > R. > > On 9/18/07, merelypixels <[EMAIL PROTECTED]> wrote: > > > > seems to me that no mucking about with itemEditors is necessary... > > extract the data you need from your dataProvider and then validate > > that data directly before sending it on. If you want the little red > > validation things, you should probably validate on a field by field > > basis using the dataGrids itemEditEnd event, validating using > > dg.itemEditorInstance and doing e.preventDefault() if the field is > > invalid. > > > > Hope that helps! > > -Pixels > > > > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, > > "j_lentzz" <jelentz@> wrote: > > > > > > Hi, > > > > > > I'm now trying to validating the contents of a datagrid and I was > > > wondering if there is an established way to do this. It seems like I > > > would need to get an instance of the itemEditor and somehow pass it > > > the value on that row. Then I would either call a validator against > > > that editor, or call a method contained in the itemEditor to do the > > > validation. I can get the itemEditor to do validation when the user > > > is entering data, but I need to be able to do validation on all the > > > entries in the datagrid when the save button is pressed - to handle > > > the cases of missing data in required datagrid fields. I've found > > > some examples of how to validate when the user is entering data for > > > that field, but not for validating the complete datagrid. Any help or > > > ideas would be greatly appreciated. > > > > > > John > > > > > > > > > >