Advertisement
Guest User

Untitled

a guest
Jul 18th, 2015
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Layout = new dhtmlXLayoutObject(document.body,"2U","dhx_skyblue");
  2. MainLayout = Layout.cells('b');
  3. SidebarTree.attachEvent("onClick", function(id) {
  4.         var view = SidebarTree.getUserData(id,"view");
  5.         var ctrl = SidebarTree.getUserData(id,"controller");
  6.         var status = false;
  7.         if (view === undefined) {
  8.             status = MainLayout.showView('def');
  9.         }
  10.         else {
  11.             status = MainLayout.showView(view);
  12.             if (Views[view] === undefined) {
  13.                 Views[view] = id;
  14.                 Load(true);
  15.             }
  16.         }
  17.        
  18.         if (status) {
  19.             if (App[ctrl] !== undefined && typeof App[ctrl].index === 'function') {
  20.                 App[ctrl].index();
  21.             }
  22.             else {
  23.                 console.warn("Controller not loaded or don't have index method.");
  24.             }
  25.         }
  26. });
  27.  
  28. And My "Controller":
  29.  
  30. App.Tlist = {
  31.     index: function() {
  32.         if (this.Ribbon === undefined) {
  33.             this.Ribbon = MainLayout.attachRibbon();
  34.             this.Ribbon.loadStruct(BASEURL + "tlist/loader/ribbon",function() {
  35.                 var fromInput = App.Tlist.Ribbon.getInput('calendarFrom');
  36.                 var toInput = App.Tlist.Ribbon.getInput('calendarTo');
  37.                 $(fromInput).height(17);
  38.                 $(toInput).height(17);
  39.  
  40.                 var Calendar = new dhtmlXCalendarObject([fromInput,toInput]);
  41.                 Calendar.setDateFormat('%Y-%m-%d %H:%i');
  42.             });
  43.         }
  44.         Load(false);
  45.     }
  46. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement