0 Replies Latest reply on Jul 17, 2011 11:41 PM by Venkatesan Balasubramanian

    Implicit coercion of a value of type String to an unError while Adding Dynamic Rows To Flex DataGrid

    Venkatesan Balasubramanian


       

      Hi friends

       

      I  want to add interger for in next next rows while clicking tab  button,one i enter all the values in one row if i press tab means next  row will be editable.for making that i added the following code.i have  some error shows like this

       

       

       

       

          [Bindable]
                      private var tasks:ArrayCollection;
                      private static const ADD_TASK:int= "";
                     
                      private function init():void
                      {
                          tasks = new ArrayCollection();
                          tasks.addItem(new Task(0.01,100000,0));
                          tasks.addItem({frmAmount:ADD_TASK});
                      }   
                      private function checkEdit(e:DataGridEvent):void
                      {
                          // Do not allow editing of Add Task row except for
                          // "Click to Add" column
                          if(e.rowIndex == tasks.length - 1 && e.columnIndex != 0)
                              e.preventDefault();
                      }
              private function editEnd(e:DataGridEvent):void
              {
                      // Adding a new task
                      if(e.rowIndex == tasks.length - 1)
                  {
                      var txtIn:TextInput =TextInput(e.currentTarget.itemEditorInstance);
                      var dt:Object = e.itemRenderer.data;
                     
                      // Add new task
                      if(parseInt(txtIn.text) != ADD_TASK)
                      {
                          tasks.addItemAt(new Task(parseInt(txtIn.text), 0, ""), e.rowIndex);----->Multiple markers at this line:
                                                                                                                               -1067: Implicit coercion of a value of type String to an unrelated type int.
                                                                                                                                  -txtIn

                      }
                     
                      // Destroy item editor
                      commPlanDetGrid.destroyItemEditor();
                     
                          // Stop default behavior
                      e.preventDefault();
                      }
              }
                 
              ]]>

       

       

       

      Please help if any suggession

       

       

      Thanks in advance

      B.Venkatesan