Сенча вложенный список getActiveItem()

Я использую эту модель:

Ext.regModel('ListItem', {
    fields: [
        {name: 'id', type: 'string'},
        {name: 'text', type: 'string'},
        {name: 'number', type: 'string'}
    ]
});

вложенный список:

var nestedList = new Ext.NestedList({
            fullscreen: true,
            title: ivrData.text,
            store: NestedListDemo.music_store,
            getDetailCard: function(item, parent) {
                alert(item.attributes.record.data.number);
            }
        });

Я пытаюсь получить свойство .number для activeItem при нажатии кнопки.

handler : function(btn, evt) {
        var temp = nestedList.getActiveItem();
        alert(temp.number);
        alert(temp.attributes.record.data.number);
}

Я могу получить свойство .number на leafnode с помощью alert(item.attributes.record.data.number);, но я получаю эту ошибку при попытке получить свойство .number для temp:

alert(temp.number); печатает --> не определено

alert(temp.attributes.record.data.number); выдает ошибку --> "TypeError: Результат выражения 'temp.attributes' [undefined] не является объектом"


person Dhairya Vora    schedule 27.12.2011    source источник
comment
кстати, alert(temp) дает [object Object]   -  person Dhairya Vora    schedule 27.12.2011


Ответы (1)


Получил все свойства активного узла вложенного списка, используя приведенный ниже код:

nestedList.on('itemtap', function(subList, subIdx, item, e, detailCard) {
    alert(subList.getRecord(item).get('id'));
    alert(subList.getRecord(item).get('name'));
    alert(subList.getRecord(item).get('number'));
});

Я храню эти значения в локальных переменных.

person Dhairya Vora    schedule 28.12.2011