0
votes

I have a simple Sencha App that has a main view. The view extends the Ext.navigation.View so that I can "push" to a new view when the user selects an item in the list. This happens by setting up a listener and then calling the push function on the MainView object.

However, I'm having problems getting the data across to that view. I tried using the answer from this StackOverflow question, but it didn't work.

In that answer it suggests that you use the record parameter of the itemTap() function, but this returns as an empty object.

Why does record return as an empty object?

Perhaps I'm going about this the wrong way?

In my case, I have a list of "brands", each with a title, image and description. I'd like to use that in the panel that slides in.

The launch function of my app which creates the view and ads to the viewport

launch: function() {
    // Destroy the #appLoadingIndicator element
    Ext.fly('appLoadingIndicator').destroy();

    // Create instance of the main view so we can use it's functions
    SenchaTest.MainView = Ext.create('SenchaTest.view.Main');

    // Initialize the main view
    Ext.Viewport.add(SenchaTest.MainView);
},

Here is my view

Ext.define('SenchaTest.view.Main', {
    extend: 'Ext.navigation.View',
    xtype: 'main',

    requires: [
        'Ext.TitleBar',
        'Ext.Video',
        'Ext.carousel.Carousel',
        'Ext.Img'
    ],

    config: {
        fullscreen: true,

        items: [
            {
              title: 'Test',

              layout: {
                  type: 'vbox',
                  align: 'stretch'
              },

              items: [{
                xtype: 'highlightscarousel',
                flex: 0.35
              }, {
                xtype: 'list',
                displayField: 'title',
                flex: 0.65,

                store: Ext.create('SenchaTest.store.Brands'),
                itemTpl: '<img src="{image}" class="listThumb"><h1 class="listTitle">{name}</h1><span class="clearFloat"></span>',

                listeners: {
                  itemtap: function(nestedList, list, index, element, post, record) {

                  }
                }
              }]
            }
        ]
    }
});
1

1 Answers

0
votes

Based on the Sencha Touch docs, the signature of the itemtap listener is:

(this, index, target, record, e, eOpts)

you're using:

(nestedList, list, index, element, post, record)

so that might be why the record is an empty object. If that's not the case, could you post a JSFiddle or some kind of working example of the problem?