PDA

View Full Version : Get the selected value in the list view



ian12312
23 Aug 2009, 3:45 PM
I'm new to trying out ExtJS and have a question.

In the code below I have a store and an Ext.ListView - my question is how do i get the value of the data in the "id" column for a single selected row, e.g. var selectedId = resources50004792.getTheValueOfIdForTheSelectedRow


try {var resources50004792Store = new Ext.data.ArrayStore({
fields: ['id', 'display'],
data : [
['50000014', 'Alexander, John MD'],
['50000015', 'Butler, Bobby MD'],
['50000017', 'Odell, Olive MD'],
['50001732', 'Kemeny, Barbara'],
['50001756', 'Nightingale, Nancy RN'],
['50001755', 'Fizzijon, Philip MD'],
['50001759', 'Cessation, Cecil'],
['50001758', 'Midwife, Margaret'],
['50000001', 'Coneyberry'],
['50000000', 'Coneyberry Facility'],
['50002937', 'Operating Room 1'],
['50002938', 'Pre-Admit Clinic'],
['50000016', 'Jones, Jamie MD'],
['', '']]
});
var resources50004792 = new Ext.ListView({
store: resources50004792Store,
emptyText: 'No images to display',
reserveScrollOffset: true,
height: 20,
singleSelect: true,
columns: [{
header: 'Resource',
width: 2,
dataIndex: 'display'
},
{
header: 'ID',
width: 0,
dataIndex: 'id'
}], renderTo: 'resources50004792'});
} catch (jserr) {}

24 Aug 2009, 4:55 AM
the API shows you that you can get the selected records:

getSelectedRecords() : Array


Did you even look at the API?

24 Aug 2009, 5:32 AM
Thanks for not answering my question. As I stated in my question I am new to using ExtJS and was looking for a friendly helpful answer from the forum - I guess I will know better next time!

BTW...I found my answer another far more helpful way.


I don't get it. The API is just full of information. The dev team spends many hours working on it so you and I can answer our own *simple* questions.