the way you focus on a cell, is you have to set the datagrid 
focusedCell property.
you could do the following.
1) always save the currentcell position in cellFocusIn
2) make the remoteobject call whenever the datagrid change is 
trigerred and set a boolean variable. (Now are you sure you want to 
make that remoteobject call after a DataGrid.change event. I dont 
think 'change' is trigerred if you use the tab key.)
3) then in back in your cellFocusIn function, check the value of 
this boolean. if its false, refocus back on your recently focused 
cell

eg (untested)

<mx:Application>
<mx:DataGrid id="dg" cellFocusIn="doCellFocusIn" change="doChange">
<mx:Script>
  var validationResult:Boolean;
  var myCell;
  
  function doChange()
  {
    //make your remoteobject call - return handler(returnDoChange())
  }
  function returnDoChange()
  {
    validationResult = true or false
  }
  function doCellFocusIn(event)
  {
    if(validationResult || myCell == undefined)
    {
      myCell = {itemIndex:event.itemIndex, 
columnIndex:event.columnIndex};
    }
    else
    {
      this.focusedCell = undefined;
      this.focusedCell = myCell;
  }

see if something like this is any good for you. 
 





--- In [email protected], "thisdudenamedjon" 
<[EMAIL PROTECTED]> wrote:
>
> I'm sorry. Let me rephrase my question and make this a little 
> simpler. I have an editable datagrid. Whenever the change event is 
> called, I send the dataProvider to a remoteObject for validation.
> 
> What I would like to do is to prevent the user from editing any 
other 
> cell if the validation finds errors in the recently edited cell. I 
> would like to force the focus to be on invalid cell until the 
error 
> is corrected.
> 
> I'm open to any suggestions on the best way to do this. Thank you.
> 
> Jon
> 
> --- In [email protected], "bhaq1972" <[EMAIL PROTECTED]> wrote:
> >
> > I'm not sure if this is what your asking so i might be wrong
> > 
> > after you've done your async remote object call and your focused 
on 
> > a combobox cellrenderer use this code (untested)
> > //maybe in cellFocusIn?
> > if(dg.cellEditor.className =="ComboBox")
> > {
> >   dg.cellEditor.addEventListener("open", mx.utils.Delegate.create
> > (this, doOpen));
> > }
> > 
> > create a function in your page called do Open
> > function doOpen(event)
> > {
> >   event.target.close();
> > }
> > 
> > so everytime someone opens the combobox cell renderer, it closes.
> > 
> > 
> > 
> > 
> > 
> > 
> > --- In [email protected], "thisdudenamedjon" 
> > <[EMAIL PROTECTED]> wrote:
> > >
> > > I have a datagrid with several columns of cells that are 
editable 
> > and a 
> > > custom combobox cell renderer. When a user edits a cell and 
> > leaves, I 
> > > pass that entire row to a RemoteObject to do some validation. 
If 
> > there 
> > > are errors, I want to keep that cell focused until the errors 
are 
> > > corrected. 
> > > 
> > > Right now, I have implemented this using my datagrid's change 
and 
> > > cellEdit listeners to simply dispose the celleditor and set 
> > focused 
> > > cell to the errored cell. However, with my combobox, Mm 
invalid 
> > cell 
> > > simply loses focus and I am able to access and change it. I do 
> not 
> > want 
> > > to allow access to this combobox while I still have an error.
> > > 
> > > Can someone point me towards a more elegant solution or 
something 
> > to 
> > > force the focus back onto the invalid cell when I access the 
> > combobox.
> > > 
> > > Thanks.
> > >
> >
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to