I created the projects with all the steps explained in that guide, and created a package that contains all the model and stores called SharedData. I also added the package in the requires property inside both app.json (ExtSpace and TouchSpace).
The folder schema is this:
ProjectMainFolder
|
|----.sencha
|----ext (ExtJS5 framework code)
|----ExtSpace (ExtJS5 app)
| ----.sencha
| ----app
| ----resources
| ----sass
| ----app.js
| ---- ....(more Extjs 5 app files and folders)
|
|----touch (sencha touch framework code)
|----TouchSpace (Sencha Touch app)
| ----.sencha
| ----app
| ----resources
| ----app.js
| ---- ....(more Sencha Touch app files and folders)
|
|----packages
|----SharedData
|----src
| ----model (folder with all the models)
| ----store (folder with all the stores)
|----more folders and files that belongs to the package
I tried to import models and stores in my Application.js in the ExtJS5 side and in app.js in the Touch side. Like the following:
Code:
// Application.js - EXTJS5 (ExtSpace folder)
Ext.require([
'SharedData.*',
'SharedData.model.*',
'SharedDataModels.store.*']);
Ext.define('MyApp.Application', {
name: 'MyApp',
extend: 'Ext.app.Application',
views: ['Main'],
models: [
'SharedData.model.Model1',
'SharedData.model.Model2'
],
stores: [
'SharedData.store.Store1',
'SharedData.store.Store2'
],
controllers: ['Main' ]
});
//app.js - Sencha Touch (TouchSpace folder)
Ext.application({
name: 'MyTouchApp',
requires: [
'Ext.TitleBar',
'Ext.MessageBox',
'Ext.field.Search',
'Ext.form.FieldSet',
],
models: [
'SharedData.model.Model1',
'SharedData.model.Model2'
],
stores: [
'SharedData.store.Store1',
'SharedData.store.Store2'
],
controllers: ['Main'],
views: ['Main']
});
The result is that the Sencha Touch application is working, but the ExtJS application is not recognizing the full qualified named of the shared classes, so it tries to load the models and the stores from inside the app: (i.e. fail to load from http://localhost/ProjectMainFolder/E...tore/Store1.js ). It looks like Extjs5 doesn't accept full qualifies class names inside models or stores property.
In the other hand, Sencha Touch recognizes the model and stores names, and it loads it from http://localhost/ProjectMainFolder/p...tore/Store1.js and everything works fine.
Any workaround or idea for solving this problem?
Thank you in advance
Sharing models and stores between Extjs5 and Touch
Aucun commentaire:
Enregistrer un commentaire