I am doing to this successfully. To scroll the dg you need to set
vPosition, but I don't see anything else wrong.

Put a trace in the loop so you can look at the comparison:
trace("indexOf: " + dg.dataProvider[x].name + " search for: " +
TextInput.text) 

Tracy
Here is my code:

        private function findInitDep(oEvent:Object):Void
        {
                var sSearchString:String = oEvent.target.text;
                var aDepLists:Array = publisher.gaDependencyLists;
                var oDepList:Object;
                var sLabelLC:String;
                sSearchString = sSearchString.toLowerCase();
                for ( var i:Number=0; i<aDepLists.length; i++ )  {
                        oDepList = aDepLists[i];
                        sLabelLC = oDepList.label.toLowerCase();
                        if (sLabelLC.indexOf(sSearchString) > -1)  {
                                dgInitial.selectedIndex = i;
                                dgInitial.vPosition = i;
                                return;
                        }
                }//for ( var i:Number=0;....
                dgInitial.selectedIndex = -1;
        }//

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of devis
Sent: Thursday, May 26, 2005 5:45 AM
To: [email protected]
Subject: [flexcoders] How i can do it?

Hi, i  have a dataGrid into a panel with a controlBar.
In my control bar there is a TextInput, 
i wish then a user press keyDown  put "focus" in the dataGrid row.
I have used indexof of research but don't work here a bit code

function Find():Void
{
  for(var x;x<dg.dataProvider.length;x++)
{
     if(dg.dataProvider[x].name.indexOf(TextInput.text) >-1)
    {
        //Here i wish to set dataGrid Row
       dg.selectedIndex=x;????? here don't work, and if my dataGrid show

scrollBar this function   don't scroll
       // break because i wish to stop the reserch at first Element
        break;
    }
} 
Can you help me please?
Devis

ps.
sorry, i don't know very well ActionScript.
But there is an other method for searching subString into a String, 
sometimes indexof don't work well




 
Yahoo! Groups Links



 






 
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