2 Replies Latest reply on Jul 24, 2007 11:28 AM by Newsgroup_User

    datagrid column focus

    Level 7
      Hi,
      I got the column focus after create a row in my datagrid, now I want to
      create a general function for all my datagrids but I got an error
      Implicit coercion of a value of type void to an unrelated type Function.
      Looks like I can't pass my datagrid value in the function
      Tks
      JFB
      Here is my code

      callLater(focusNewRow(myDataGrid)); --> here is the error

      }

      public function focusNewRow(tempDataGrid:DataGrid):void{
      tempDataGrid.editedItemPosition = {
      columnIndex:0,rowIndex:tempDataGrid.dataProvider.length-1
      };
      }


        • 1. Re: datagrid column focus
          Robert Hirst Level 1
          callLater takes two parameters, the first is the name (e.g. no parentheses) of the function, and the second is an array of parameters. If you have the brackets, then Flex will assume you want the function to be evaluated and so you are passing "void" into the callLater method.

          I believe what you want to do looks more like this:

          callLater(focusNewRow,[myDataGrid]);
          • 2. Re: datagrid column focus
            Level 7
            That fixed the problem...
            Thank you Robert.
            Rgds

            JFB

            "Robert Hirst" <webforumsuser@macromedia.com> wrote in message
            news:f858na$4im$1@forums.macromedia.com...
            > callLater takes two parameters, the first is the name (e.g. no
            > parentheses) of
            > the function, and the second is an array of parameters. If you have the
            > brackets, then Flex will assume you want the function to be evaluated and
            > so
            > you are passing "void" into the callLater method.
            >
            > I believe what you want to do looks more like this:
            >
            > callLater(focusNewRow,[myDataGrid]);
            >
            >