Results 1 to 4 of 4

Thread: Get all the values from a selected row on a grid?

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    2
    Vote Rating
    0
      0  

    Default Get all the values from a selected row on a grid?

    Get all the values from a selected row on a grid?

    I am using GXt GWt and am trying to get the values from a selected row in a tree grid, but can't seem to get it working..

    E.g. if the user clicks row, i want to be able to get the values for all the columns in that row.


    cm =newColumnModel(createColumnConfig());

    // Create grids based on data (held in stores), and attach listeners for when a row is clicked
    finalTreeGrid<Build> nightlyResultsGrid = createTreeGrid(nightlyResultsStore);

    nightlyResultsGrid
    .addListener(Events.RowClick,newListener<BaseEvent>()
    {
    publicvoid handleEvent(BaseEvent clickEvent)
    {
    GridEvent gridEvent =(GridEvent)clickEvent;

    gridEvent
    .getModel().get("Platform").toString();
    gridEvent
    .getModel().get("Date").toString();
    gridEvent
    .getModel().get("Build").toString();
    }
    }The code above keeps generating an exception..
    15:58:09.861 [ERROR] [dashboard] Uncaught exception escaped java.lang.NullPointerException: null at com.rory.mep.ui.metrics.client.UserInterface$3.handleEvent(UserInterface.java:109) at com.extjs.gxt.ui.client.event.BaseObservable.callListener(BaseObservable.java:178) at com.extjs.gxt.ui.client.event.BaseObservable.fireEvent(BaseObservable.java:86) at com.extjs.gxt.ui.client.widget.Component.fireEvent(Component.java:456) at com.extjs.gxt.ui.client.widget.grid.Grid.onClick(Grid.java:811) at com.extjs.gxt.ui.client.widget.treegrid.TreeGrid.onClick(TreeGrid.java:745)
    Any help is much appreciated.

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Vote Rating
    131
      0  

    Default

    The NPE gets thrown in your code. Probably one of your get("dataindex" calls returns null and so you cannot call toString on it

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    2
    Vote Rating
    0
      0  

    Default

    Thanks Sven.

    I was using the column heading text instead of the column id

  4. #4
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Vote Rating
    1381
      0  

    Default

    @Rory7902 Please do not post the same thing over and over in different forums. I have cleaned up all your duplicates.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •