1
votes

I have a grid and when I click on a button in the toolbar of the panel I want to check if a row in the grid is selected. If true I need de value of one cell of that row, so I can put it behind a url.

But I have no idea how I can use the selection model to get the cell value of a selected row in EXT JS 4.

2
get the cell render value or dataIndex(field) value? - atian25

2 Answers

4
votes

Perhaps try something like:

grid.getSelectionModel().getSelection() 

This will return an array of all selected records withing the grid.

Then, you can iterate over the selection, find your row and call row.get('PropName') to get the value.

Hope this helps.

0
votes

You're approaching the issue backwards though. You want to register for the 'selectionchange' event from the grid.

thisController.control ({'#mygrid': 
{
 selectionchange:onSelectionChange}
});

function:onSelectionChange(model, selected, eOpts )
{
//do work here
}

So basically you want to create an event driven model.