Hiding a button on pushed view and showing it when back to list view
- by torr
When I load my list view it has several blog posts and a refresh button on the top left.
If I tap on a list item a view is pushed with the contents of that specific post. When this view is pushed in, the refresh button is hidden.
But when I tap 'Back' to the parent list view, I'd like the refresh button to show (un-hide) - but it remains hidden.
Any idea how to make this work?
This is my View:
Ext.require(['Ext.data.Store', 'MyApp.model.StreamModel'], function() {
Ext.define('MyApp.view.HomeView', {
extend: 'Ext.navigation.View',
xtype: 'homepanel',
requires: [
'Ext.dataview.List',
],
config: {
title: 'Home',
iconCls: 'home',
styleHtmlContent: true,
navigationBar: {
items: [
{
xtype: 'button',
iconMask: true,
iconCls: 'refresh',
align: 'left',
action: 'refreshButton',
id: 'refreshButtonId'
}
]
},
items: {
title: 'My',
xtype: 'list',
itemTpl: [
'<div class="post">',
...
'</div>'
].join(''),
store: new Ext.data.Store({
model: 'MyApp.model.StreamModel',
autoLoad: true,
storeId: 'stream'
}),
}
}
});
});
and my Controller:
Ext.define('MyApp.controller.SingleController', {
extend: 'Ext.app.Controller',
config: {
refs: {
stream: 'homepanel'
},
control: {
'homepanel list': {
itemtap: 'showPost'
}
}
},
showPost: function(list, index, element, record) {
this.getStream().push({
xtype: 'panel',
html: [
'<div class="post">',
'</div>'
].join(''),
scrollable: 'vertical',
styleHtmlContent: true,
});
Ext.getCmp('refreshButtonId').hide();
}
});