Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remote api simulator in Extjs
Ext.define('Example.util.Remote',{
singleton: true,
requires: [
'Ext.ux.ajax.JsonSimlet',
'Ext.ux.ajax.SimManager'
],
constructor: function () {
Ext.ux.ajax.SimManager.init({
defaultSimlet: null
});
},
}, function (U) {
Ext.ux.ajax.SimManager.register({
'/calendars': {
type: 'json',
data: [{
id: 1,
title: 'Title1',
eventStore: {
proxy: {
type: 'ajax',
url: '/Calendars/1'
}
}
}, {
id: 2,
title: 'Title2',
eventStore: {
proxy: {
type: 'ajax',
url: '/Calendars/2'
}
}
}]
},
'/calendars/1': {
type: 'json',
data: function (ctx) {
var data = [
{
id: 1,
startDate: "2017-07-13T18:30:00.000Z",
endDate: "2017-07-13T19:00:00.000Z",
calendarId: 1
},
{
id: 2,
title: "Title",
startDate: "2017-07-10T13:30:00.000Z",
endDate: "2017-07-10T13:20:00.000Z",
calendarId: 1
}
]
return data;
}
},
'/calendars/2': {
type: 'json',
data: function (ctx) {
var data = [
{
id: 5,
title: "Title",
startDate: "2017-07-13T08:30:00.000Z",
endDate: "2017-07-13T09:00:00.000Z",
calendarId: 2
},
{
id:6,
title: "Title",
startDate: "2017-07-13T08:30:00.000Z",
endDate: "2017-07-13T09:00:00.000Z",
calendarId: 2
}
]
return data;
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.