PDA

View Full Version : Extracting a value from the currently selected item in Ext.List



novosmt
6 Apr 2012, 12:52 PM
I am trying to programmatically obtain the selected value of a List item when a button is tapped. The code below is getting me close but I am not sure how to now access the DATA elements for the selected List item. note: topicList was created earlier.

my code:
nextBtn = Ext.create('Ext.Button', {
id: 'nextBtn',
ui: 'forward',
text: 'Next',
listeners: {
tap: function(view, record) {
console.log(topicList.getSelection());
}
}
});

the code above returns this... I am trying to get access the the Id value...but do not know the method to do so.
[
Ext.apply.create.Class


_data: Object
data: Object

id: 1
topic: "POS eLearning Basics"
__proto__: Object

id: "ext-record-1"
modified: Object
raw: Object
stores: Array[1]
__proto__: TemplateClass






Thanks for taking your time to reply,
Steve

novosmt
6 Apr 2012, 2:26 PM
topicList.getSelection()[0].data.id - Returns the 'id' value of the currently selected item in topicList.

-steve