0
votes

I'm trying to get the item disclosure to work in a list item in Sencha Touch using a controller ref. But the event never seems to fire/receive inside controller. All of the examples I've seen have the list item using a listener but I thought that wasn't very MVC so I'm trying to do it this way (is there any reason why they use listeners instead of a controller?)

In my view, the list is an item inside the EnquiryIndex view.

When I do this in a console window it returns the list correctly so I know the ref is working ok:

Ext.ComponentQuery.query("enquiryindexview list")[0]

See below example:

Ext.define('MyApp.controller.EnquiryIndex', {
    extend: 'Ext.app.Controller',

    requires: [

    ],

    config: {
        refs: {           
           enquiryIndexViewRef: 'enquiryindexview list'
        },

    control: {
        'enquiryIndexViewRef': {
            disclose: 'onDiscloseEnquiryIndex'
        }            
    }
},

onDiscloseEnquiryIndex: function (rec) {

   // never gets here!
}

});

2
what about doing '#enquiryindexview list' instead - cclerv
Did you get this to work? - cclerv
I tried using 'itemtap' instead and this seems to work. Is there any reason why disclose doesn't work? What is the difference between the 2? - jaffa
Does your list's config include, onItemDisclosure : true? - Josh
Also worth noting, When any of the listeners returns false, the action (disclose) is cancelled. - Josh

2 Answers

0
votes

Try this

config: {
  control: {
    'enquiryindexview list': {
      disclose: 'onDiscloseEnquiryIndex'
  }            
}

or this

config: {
  refs: {           
     enquiryIndexViewRef: 'enquiryindexview list'
  },

  control: {
    enquiryIndexViewRef: {
      disclose: 'onDiscloseEnquiryIndex'
  }            
}

Hope this helps

0
votes

What you might have missed doing is adding this line in the app.js

controllers: ['EnquiryIndex'],

Try this out, it should work now.