Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 41

Thread: How can i get the selected cell value in the grid?

  1. #21
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,676

    Default

    yeah, but anyway he will have all relevant information here.
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  2. #22

    Default

    It's a miss understanding .

    I am trying to get the 'id' which is one of the column on my grid, I thought you are trying to show me a better way to get it, but you try to get row ID I believe.

    Another mistake is you use myGrid instead of g in the example, but then the results are differences

    steffenk code work for me though

    CONCLUDE: Everyone should use steffenk's last post for select a special column value when double click on a grid row

    BTW, anyone has better idea is always welcome

  3. #23

    Default

    I think I am following this thread:

    How can i get the selected cell value in the grid?

    and I just post my n00b code that work and yes, it is n00b but not random, and just ask for better idea as I am still try to understand the API. At least I got the answer

  4. #24
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    Are you using a CellSelectionModel?

    Or do you mean the value in a grid cell that you double click on?

  5. #25
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,676

    Default

    i think he wantet the last one.
    id is not clear, normally everyone think it's the unique id of the data
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  6. #26

    Default

    Hehe, you should not be asking me but mingwong00

    I am just following along. And did I mention I am EXTJS 3 days n00b? Well, today is 4th day.

    I know id is not clear, but before I showed the code, I did mention employee_id, didn't I? May be I did not state it clearly enough, sorry for my bad English.

  7. #27
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    Right.

    Code:
         grid.on("celldblclick", function(grid, row, column, e) {
            var rec = grid.getDataSource().getAt(row);
            var fieldName = grid.getColumnModel().getDataIndex(column);
            alert("Cell value: " + rec.get(fieldName));
        });

  8. #28
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,676

    Default

    the "all-in-one-solution"
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  9. #29

    Default

    IT IS VERY CLEAR & BASIC

    Sorry for being ridiculous here but a grid/table is just a 2D array, and you already has colIndex, rowIndex, is there any way we can have something like

    TheValueIWant = THEGRIDDATA[rowIndex][colIndex].value???

    BTW, Animal, is there any short (optimize) version of your code?

  10. #30
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    No, it i not a 2d array.

    It is an MVC Grid control. The data is in the Model.

    That is the object you query to get the data.

    The way I show is the way to do it.

    First access the Record that backs up a Grid row.

    The column index is the index into the ColumnModel. You then ask the ColumnModel which data field from the Record it uses.

    Then extract that field value from the Record.

    Are you trolling now? I mean are you taking the piss?

Page 3 of 5 FirstFirst 12345 LastLast

Posting Permissions

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