4 Replies Latest reply: Jul 31, 2012 11:37 AM by eZACKe RSS

    Flexicious Ultimate: grid.setSelectedObjects causes cell.column, cell.rowInfo, etc to be null

    eZACKe

      So I have a Flexicious Data Grid. What I'm trying to do is make it so that when you click on an editable cell, it will also select the cell and thus select the row. So I have code that looks like this:

       

      this.column.level.grid.addEventListener(FlexDataGridEvent.ITEM_EDIT_BEGIN, editCell);

       

      protected function editCell(event:FlexDataGridEvent) : void {

              event.grid.setSelectedObjects([event.item]);

              event.grid.invalidateCells();

          }

       

      The problem though, comes from within the Flexicious source code itself in FlexDataGridContainerBase.as. When you click on an editable cell, the beginEdit() method is called. At the bottom of this method is this chunk of code:

       

      evt= new FlexDataGridItemEditEvent(FlexDataGridEvent.ITEM_EDIT_BEGIN,grid,cell.level,cell.column,c ell,cell.rowInfo.data);

                                    evt.itemEditor=editor;

                                    cell.column.dispatchEvent(evt);

       

                                    evt= new FlexDataGridItemEditEvent(FlexDataGridEvent.ITEM_FOCUS_IN,grid,cell.level,cell.column,cel l,cell.rowInfo.data);

                                    evt.itemEditor=editor;

                                    grid.dispatchEvent(evt);

       

       

      So that first chunk executes, then my editCell method would execute, then the second chunk in FlexDataGridContainerBase executes. The problem though, is when my editCell() function is executed, when the code gets back in FlexDataGridContainerBase, cell.column, cell.rowInfo, etc are all null. Before editCell() call they obviously weren't otherwise cell.column.dispatchEvent(evt) wouldn't have worked.

       

      If I take out my call to editCell(), then when it gets to the second chunk of code, all that stuff isn't null and remains what it was.

       

      So what is happening in my call to getSelectedObjects that causes cell.column, etc to become null in FlexDataGridContainerBase?

       

      Thank you!