问题
Here is my SubView
I am reworking my UI. At first my back button was a real button in my titlebar. The logic of this button worked perfectly and was MVCed. Now I have linked my tab to send the proper signal to the controller. The controller does receive and navigate threw my Tree structure correctly.
The problem is that the Dataview.dataview in the Project Tab is not displaying properly after a tap on the back button.
Here is my code
onSubviewActiveItemChange: function(container, value, oldValue, eOpts) {
var me = container;
switch(value.getItemId())
{
case 'back_Innertab':
me.fireEvent('goback');
break;
case 'exit_Innertab':
me.fireEvent('exit');
break;
case 'project_Innertab':
me.fireEvent('reloadchildren')
break;
case 'chart_Innertab' :
me.fireEvent('categorydisplay',me.getComponent('chart_Innertab').getComponent('pie'));
break;
}
}
With that code, when Back tab is tapped, the controller does the job has intented, and my tabpanel send me into the Back tab. If I were to go to Project tab, it would display the right elements. Nice but I don't want to need a 2nd tap to go back to Project Tab. So here would be my code
onSubviewActiveItemChange: function(container, value, oldValue, eOpts) {
var me = container;
switch(value.getItemId())
{
case 'back_Innertab':
me.fireEvent('goback');
me.setActiveItem(oldValue);
break;
case 'exit_Innertab':
me.fireEvent('exit');
break;
case 'project_Innertab':
me.fireEvent('reloadchildren')
break;
case 'chart_Innertab' :
me.fireEvent('categorydisplay',me.getComponent('chart_Innertab').getComponent('pie'));
break;
}
}
Normally it would send me back to the active tab before the tap, but it does not. It send me back to Back Tab but with the Project Tab overlayed...
Here is the inspector... (inspecting the grey area in screenshot, after a Back Tab Tap)
How can I correct that to really be in the Project Tab and have it displayed properly? I really need it and can't seem to find a way of doing so :S
回答1:
OnActiveItemChange
If you are to change tab inside of this event cause by a tab change, the result is nearly undefined the back-end implementation of it is not able to support such task correctly.
来源:https://stackoverflow.com/questions/18193917/activeitemchange-and-dataview-dataview-display