PDA

View Full Version : Code for Stores



vmadman
31 Mar 2010, 7:12 AM
Can the code generator create the code for the stores I create?

Currently it seems to just reference them by name, like:

store: 'MyStore'

But does not, in any way, define MyStore in the outputted class/json code.

Will this be added? And, will the custom components api (coming soon I assume) also support custom stores?

Thanks,
Luke

aconran
31 Mar 2010, 7:25 AM
Luke -

Take a look at the store files which are generated.


/*
* File: CompanyStore.js
* Date: Wed Mar 31 2010 08:22:10 GMT-0700 (PDT)
*
* This file was generated by Ext Designer version 1.0.0.
* http://www.extjs.com/products/designer/
*
* This file will be generated the first time you export.
*
* You should implement event handling and custom methods in this
* class.
*/

CompanyStore = Ext.extend(Ext.data.ArrayStore, {
constructor: function() {
CompanyStore.superclass.constructor.call(this, {
storeId: 'CompanyStore',
fields : [
{
xtype: 'datafield',
name: 'company',
type: 'auto'
},
{
xtype: 'datafield',
name: 'price',
type: 'float'
},
{
xtype: 'datafield',
name: 'change',
type: 'float'
},
{
xtype: 'datafield',
name: 'pctChange',
type: 'float'
},
{
xtype: 'datafield',
name: 'lastChange',
type: 'date',
dateFormat: 'n/j h:ia'
}
]
});
}
});
new CompanyStore();


These files are generated once you can remove them to re-create them if you need any changes made to them.



And, will the custom components api (coming soon I assume) also support custom stores?
Yes.

vmadman
31 Mar 2010, 11:48 AM
Shouldn't they be recreated during each export, regardless of whether or not the file already exists?

I have not managed to get a project to export yet (the button is greyed out). What conditions is it waiting for before allowing me to export?

Thanks,
Luke

aconran
31 Mar 2010, 11:58 AM
Shouldn't they be recreated during each export, regardless of whether or not the file already exists?
Yes, I believe we are going to change this behavior.



I have not managed to get a project to export yet (the button is greyed out). What conditions is it waiting for before allowing me to export?
You need to have a project to export the project. Save the project and the export button will be enabled. By default, generated code will saved in the same directory as where the .xds file resides. You can change this by going to Edit -> Preferences and providing a relative directory to where the .xds file is.