Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function swapDiv(e) {
- selection = e.value;
- var url = '';
- var model = {};
- switch (selection) {
- case 'Usuarios':
- url = "http://127.0.0.1:81/SismosService.svc/usuario/index";
- template = '#usuariosTemplate';
- model = {
- id: "Nombre",
- fields: {
- Nombre: { type: "string" },
- ApellidoP: { type: "string" },
- ApellidoM: { type: "string" },
- }
- };
- break;
- case 'Regiones':
- url = "http://127.0.0.1:81/SismosService.svc/region/index";
- template = '#regionesTemplate';
- model = {
- id: "Nombre",
- fields: {
- Nombre: { type: "string" }
- }
- };
- break;
- case 'Clusters':
- url = "http://127.0.0.1:81/SismosService.svc/cluster/index";
- template = '#clustersTemplate';
- model = {
- id: "Nombre",
- fields: {
- Nombre: { type: "string" }
- }
- };
- break;
- case 'Dispositivos':
- url = "http://127.0.0.1:81/SismosService.svc/dispositivo/index";
- template = '#dispositivosTemplate';
- model = {
- id: "Alias",
- fields: {
- Alias: { type: "string" }
- }
- };
- break;
- case 'Eventos':
- url = "http://127.0.0.1:81/SismosService.svc/evento/index";
- template = '#eventosTemplate';
- break;
- }
- $.ajax({
- url: url,
- success: function (data) {
- var src = null;
- if (template == '#eventosTemplate')
- {
- src = getEventosArray(data);
- }
- else
- {
- src = data.Response;
- }
- var ds = new kendo.data.DataSource({
- data: src,
- schema: {
- model: model
- }
- });
- $('#listView').kendoListView({
- dataSource: ds,
- template: kendo.template($(template).html())
- });
- },
- error: function (data) {
- console.log('Error: ' + JSON.stringify(data));
- }
- });
- $('#selectionBar').animate({
- left : '189'
- }, 500);
- $('#dataBar').animate({
- left: '0'
- }, 500);
- $('#myMap').animate({
- left : '370'
- }, 500);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement