Search code examples
sencha-touchlisteners

Sencha Touch: Passing data from the 'listeners' to the detail view panel


I am using the

  onItemDisclosure: function(record, btn, index) {...

but I require the whole list to be clicked, so now I am using the

  listeners: {
        itemtap: function (list, index, element, event) {...

to goto my detailed view.

BUT how would / could I pass the data that I have been passing using the 'onItemDisclosure' now using the 'listeners' method.

Current:

    onItemDisclosure: function(record, btn, index) {
        btToolbar.setTitle(record.data.title);
        detailPanel.update(record.data);
        App.viewport.setActiveItem(detailPanel, {type: 'slide', direction: 'left'});
    }

Proposed:

    listeners: {
        itemtap: function (list, index, element, event) {
            btToolbar.setTitle(??????????????);
            detailPanel.update(???????????????);
            App.viewport.setActiveItem(detailPanel, {type: 'slide', direction: 'left'});
        }
    }

Solution

  • You need to retrieve the item from your data store using:

    itemtap: function (list, index, element, event) {
       var record = store.getAt(index);
    }