Skip to content

Instantly share code, notes, and snippets.

@sunvisor
Created January 5, 2012 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunvisor/1564158 to your computer and use it in GitHub Desktop.
Save sunvisor/1564158 to your computer and use it in GitHub Desktop.
Snippet for Ext JS 4
snippet app
Ext.application({
name: '${1:AppName}',
autoCreateViewport: true,
controllers: [
'Controller'
],
launch: function() {
// Initialize
}
});
snippet controller
Ext.define('${1:AppName}.controller.${2:ControllerName}', {
extend: 'Ext.app.Controller',
init: function () {
var me = this;
me.control({
'hogectrl': { click: me.hogeClick }
});
}
});
snippet model
Ext.define('${1:AppName}.model.${2:ModelName}', {
extend: 'Ext.data.Model',
fields: [
'id',
'field1'
],
proxy: {
type: 'direct',
directFn: ${1:AppName}.${3:directFunction},
reader: {
type: 'json',
root: 'data',
successProperty: 'success'
}
}
});
snippet store
Ext.define('${1:AppName}.store.${2:StoreName}', {
extend: 'Ext.data.Store',
model: ${3:Modelname},
autoLoad: true
});
snippet viewport
Ext.define('${1:AppName}.view.Viewport', {
extend: 'Ext.container.Viewport',
layout: 'border',
items: [
xtype: 'panel',
title: '${2:AppTitle}',
layout: 'fit',
region: 'center',
tbar: {
xtype: 'toolbar',
items: [
{
xtype: 'button',
text: '新規追加'
},
{
xtype: 'button',
text: '訂正'
}
]
}
]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment