After a little more investigation, I made the myMethod look like this:
public function myMethod(arg:Number):void{
Alert.show("-" + this.getChildren().toString() + "-");
}
As it turns out, it's not finding anything in the headerRenderer (even
though I can see the ComboBox on the stage). Anyone know why it's
doing this?
--- In [email protected], "honoraryvato"
<[EMAIL PROTECTED]> wrote:
>
> It's none initializing. I know it is. It's already displaying on the
> screen when I click on the button to update the headerRenderer.
>
>
>
>
>
>
> --- In [email protected], "lytvynyuk" <lytvynyuk@> wrote:
> >
> > Exactly in your case you probably calling that renderer too soon,
> > before myCombo finished initialization....
> >
> > --- In [email protected], "honoraryvato"
> > <honoraryvato@> wrote:
> > >
> > > I have a DataGrid. In the headers of the DataGrid I have a
> > > headerRenderer that adds a ComboBox in the header. This part is
> > > working just fine. My question is how can I call a custom method
in my
> > > headerRenderer MXML file to change the selectedIndex of the
ComboBox?
> > > I can pass variables to the header when it creates it initially
but I
> > > need to do it after the header has been initialized.
> > > The code that I have so far that calls the method in the
headerRender
> > > looks like this:
> > > (myDataGrid.columns[0] as
> > > DataGridColumn).headerRenderer.newInstance().myMethod(4);
> > > Zero being the first column. Four being the index I want it to
go to.
> > > Inside my headerRenderer the myMethod looks like this:
> > > public function myMethod(arg:Number):void{
> > > myCombo.selectedIndex = arg;
> > > }
> > > If I trace or Alert "arg" it works just fine. But if I make it do
> > > anything with myCombo it gives me an error.
> > >
> > > Does anyone know how to call a method in an headerRenderer and
have it
> > > interact with the elements in the headerRenderer?
> > >
> >
>