Skip to content

Instantly share code, notes, and snippets.

@DanielGallo
Created March 21, 2018 22:20
Show Gist options
  • Save DanielGallo/2dac95d592af3aa7d50ec34b3cb4a0e1 to your computer and use it in GitHub Desktop.
Save DanielGallo/2dac95d592af3aa7d50ec34b3cb4a0e1 to your computer and use it in GitHub Desktop.
Ext JS - AMF Store example
/**
* The main application class. An instance of this class is created by app.js when it
* calls Ext.application(). This is the ideal place to handle application launch and
* initialization details.
*/
Ext.define('MyApp.Application', {
extend: 'Ext.app.Application',
requires: [
'Ext.direct.AmfRemotingProvider'
],
name: 'MyApp',
quickTips: false,
platformConfig: {
desktop: {
quickTips: true
}
},
init: function() {
Ext.direct.Manager.addProvider({
url: 'http://localhost:1841/amfurl',
type: 'amfremoting',
id: 'product',
binary: true,
endpoint: 'my-secure-amf', // the name of the HTTPEndpoint channel as defined in the server's services-config.xml
actions: {
product: [{ // name of the destination as defined in remoting-config.xml on the server
name: 'getProducts',
len: 0 // number of parameters
}]
},
namespace: 'MyApp'
});
}
});
// Example Store definition (e.g. "store/Product.js")
Ext.define('MyApp.store.Product', {
extend: 'Ext.data.Store',
requires: [
'Ext.data.proxy.Direct'
],
alias: 'store.product',
model: 'MyApp.model.Product',
autoLoad: true,
proxy: {
type: 'direct',
directFn: 'MyApp.product.getProducts', // Define your direct method here
reader: {
type: 'json',
rootProperty: 'data'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment