JSFiddle - React, Tailwind, and code Playground
HTML
<p>In this example, two alert boxes will be popping up: one is before the store load, another one is after the store has finished loading</p>
<p>This is an example regarding coding style in ExtJS</p>
CSS
p{
font-family:arial;
font-size:12px;
line-height:1.5;
margin-bottom:10px;
}
JavaScript
Ext.define('MyApp.data.SimpleStore', {
extend: 'Ext.data.Store',
url: 'afsud',
root: 'data',
type: 'json',
autoLoad: true,
constructor: function(cfg) {
var me = this;
console.log("thisthisthisthisthisthisthis");
Ext.apply(me, cfg || {});
me.proxy = {
type: 'ajax',
url: me.url,
reader: {
type: me.type,
root: me.root
}
};
me.callParent(arguments);
me.on('load', me.onStoreLoad, me);
me.on('beforeload', me.onBeforeLoad, me);
},
onBeforeLoad: function(st) {
alert('Store is trying to retrieve data from '+st.url);
},
onStoreLoad: function(st, records) {
if (!records) alert('And it seems like we cannot reach '+st.url);
}
});
var s = Ext.create('MyApp.data.SimpleStore', {
url: 'test.php'
});