Created
July 14, 2017 07:56
-
-
Save rattanchauhan/35db263ea5ca88f24803814deaa56652 to your computer and use it in GitHub Desktop.
Remote api simulator in Extjs
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('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