0
votes

Can I use sencha extjs stores and models for sencha touch?

I am trying to create a mobile application using sencha touch. I already have the application created with sencha extjs, but want to know if generally the stores and models from my extjs application will work for the sencha touch app? Any ideas?

I am using Sencha extjs 4.2 and Sencha touch 2.4 Thanks

2

2 Answers

2
votes

Models in Sencha Touch 2.4 needs to have the fields inside the "config" property. In the other hand, ExtJS4 can't recognize the fields when they are included in a a "config" property.

So, in my experience, models are very similar between the two platforms, but they have some small differences that you must take into account.

So, in Sencha Touch:

Ext.define('Model1', {

extend: 'Ext.data.Model',

config: {
    fields: ['test1', 'test2']
}
});

and in ExtJS:

Ext.define('Model1', {

extend: 'Ext.data.Model',

fields: ['test1', 'test2']
});

I think that this is the only change that you need to do (maybe if you try to customize a proxy or something like that, there are some other small changes)

1
votes

Code bases of common components in ExtJS and Sencha Touch are very similar, so you can port some missed functionality if needed, but when I supported project on Sencha Touch, I used models and stores in the same way as in ExtJS project.