1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    28
    Vote Rating
    0
    dmayer is on a distinguished road

      0  

    Default Getting cell value using onCellUpdated and the JSONDataModel

    Getting cell value using onCellUpdated and the JSONDataModel


    I am using a JSON data model for my grid and I added a listener for the onCellUpdated event. I tried to get the value of the grid during the onCellUpdated event but I keep getting a null value.

    Here is my onCellUpdated code:
    Code:
    function onCellUpdated(grid, rowIndex, colIndex, e){
        alert('Cell at row ' + rowIndex + ', column ' + colIndex + ' was clicked!  New value=' + grid.dataModel.getValueAt(rowIndex,colIndex));
    }
    What am I doing wrong?

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    6,956
    Vote Rating
    18
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      0  

    Default


    The data model onCellUpdated includes the data model, not the grid:

    Code:
    function onCellUpdated(grid, rowIndex, colIndex, e){
        alert('Cell at row ' + rowIndex + ', column ' + colIndex + ' was clicked!  New value=' + 
                            grid.dataModel.getValueAt(rowIndex,colIndex));
    }
    should be:

    Code:
    function onCellUpdated(dataModel, rowIndex, colIndex, e){
        alert('Cell at row ' + rowIndex + ', column ' + colIndex + ' was clicked!  New value=' + 
                             dataModel.getValueAt(rowIndex,colIndex));
    }
    The afteredit event on the grid will be the same, except with a grid as the first parameter.

  3. #3
    Ext User
    Join Date
    Mar 2007
    Posts
    28
    Vote Rating
    0
    dmayer is on a distinguished road

      0  

    Default


    That fixed it.

    Thanks,

    Jack

  4. #4
    Sencha User
    Join Date
    Aug 2007
    Posts
    1
    Vote Rating
    0
    yeweinan is on a distinguished road

      0  

    Default


    jack,would you show me full example about using onCellUpdated and the JSONDataModel !
    thank you very much!

Similar Threads

  1. How to activate a cell editor based on another cell?
    By kimu in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 21 May 2008, 11:01 AM
  2. onCellUpdated index
    By pomata in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 16 Jan 2007, 12:14 PM
  3. JSONDataModel help
    By khanh3m in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 25 Oct 2006, 4:27 PM
  4. onCellUpdated and sending updates back to the server
    By judah in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 4 Oct 2006, 11:52 PM

Thread Participants: 2