I followed this tutorial on how to use Sencha Touch 2 with Architect and an ASP.NET MVC 4 WebApi backend : https://vimeo.com/45207356# Everything works but a simple thing. As soon as I get back from the detail form, the itemtap event listner doesn't seem to work anymore. No matter if I save, delete or just hit the back button, as soon as I get back in the main view (the one with the list), there is no way I can get to the edit form again. Here is the main view code :
Ext.define('ClientTestApi.view.Main', {
extend: 'Ext.navigation.View',
config: {
id: 'Main',
items: [
{
xtype: 'list',
title: 'Songs',
id: 'ListePieces',
itemTpl: [
'<div>{Title}, {Artist}, {Album}, {Genre}, {Year}</div>'
],
loadingText: 'Chargement...',
store: 'PieceStore'
}
]
}
});
And the controller :
Ext.define('ClientTestApi.controller.PieceSimple', {
extend: 'Ext.app.Controller',
config: {
refs: {
mainView: '#Main',
formPiece: '#FormPiece',
listePieces: '#ListePieces'
},
control: {
"#ListePieces": {
itemtap: 'onListItemTap'
}
}
},
onListItemTap: function(dataview, index, target, record, e, options) {
var form = Ext.create('ClientMusiqueApi.view.FormPiece',
{
title: record.data.Titre
});
this.getMainView().push(form);
form.setRecord(record);
}
I ommited the save and delete code since the behavior happens also when you just hit the back button without doing anything.
So when I load the app, everytihing works. I click on an item and gets to the edit form ("FormPiece"). When I go back (with back button in the navigation bar for exemple), the list is diplayed OK, the items are selected when I click them, but it doesn't open the edit form this time. Does anyone know why ?
UPDATE : After a simple test (I put an alert in the onListItemTap event), I saw that the event is fired even after I come back. The problem seems to be with the "push()" method. But when I trace it in Chrome's console, it runs OK. It won't show the edit form for no apparent reason.