Last active
January 1, 2016 13:09
-
-
Save weeksdev/8149579 to your computer and use it in GitHub Desktop.
ExtJS MVC Snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.define('App.controller.exampleController', { | |
extend: 'Ext.app.Controller', | |
init: function () { | |
this.control({ | |
'#someButton': { | |
click: this.buttonAction | |
} | |
}); | |
}, | |
buttonAction: function (btn) { | |
//do stuff | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.define('App.view.exampleForm', { | |
extend: 'Ext.form.Panel', | |
xtype: 'exampleForm', | |
defaults: { | |
padding:'10 10 10' | |
}, | |
items: [{ | |
xtype: 'textfield', | |
itemId:'parameter', | |
fieldLabel: 'Parameter', | |
allowBlank: false | |
}], | |
buttons: [{ | |
text: 'search', | |
itemId:'searchBtn' | |
}] | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.define('App.view.exampleGrid', { | |
extend: 'Ext.grid.Panel', | |
requires: [], | |
controllers: ['Main'], | |
store: 'exampleStore', | |
xtype: 'exampleGrid', | |
viewConfig: { | |
enableTextSelection: true, | |
}, | |
features: [ | |
], | |
plugins: [ | |
//THIS IS A STANDARD SETTING WHICH ALLOWS FOR FASTER DATA IN GRIDS | |
'bufferedrenderer', | |
], | |
tbar: { | |
items: [ | |
'->', | |
] | |
}, | |
columns:{ | |
defaults:{ | |
}, | |
items: [ | |
{ header: "field", dataIndex: "field", hidden:true } | |
] | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.define('App.model.exampleModel', { | |
extend: 'Ext.data.Model', | |
fields: [ | |
{ name: 'field', type: 'auto' } | |
], | |
proxy: { | |
type: 'jsonp', | |
url: 'url', | |
extraParams: { | |
'param': 'value' | |
}, | |
headers: { 'Content-type': 'text/json; charset=utf-8', 'Accepts': 'text/json' }, | |
reader: { | |
type: 'json', | |
root: 'data', | |
successProperty: 'success' | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.define('App.store.exampleStore', { | |
extend: 'Ext.data.Store', | |
model: 'App.model.exampleModel', | |
autoLoad: false | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Inlcudes Store, Model, Grid, & Controller Mock-Ups