1. #1
    Sencha User
    Join Date
    Mar 2009
    Posts
    356
    Vote Rating
    0
    koko2589 is on a distinguished road

      0  

    Default win.hide help not work

    win.hide help not work


    Code:
    Preferences = Ext.extend(Ext.app.Module, {
     
     appType : 'preferences',
     id : 'preferences-win',
     
     // Link/Button actions
     actions : null,
     // Content panel
     cPanel : null,
     // Current component loaded into the content panel
     cComp : null,
     
        init : function(){
            this.launcher = {
             menuText: 'הגדרות',
                text: 'הגדרות',
                iconCls: 'gears', tooltip: '<b>שנה הגדרות הדסטופ</b>',
                handler : this.createWindow,
                scope: this
            }
        },
        createWindow : function(){
         var desktop = this.app.getDesktop();
            var win = desktop.getWindow('desktop-preferences');
            
            if(!win){
             var winWidth = 650;
       var winHeight = 400;
       
       var west = new Ext.Panel({
        border: false,bodyStyle: 'padding:25px',
     
        html: '<ul id="pref-nav-panel"> \
          <li> \
         
      <img src="images2/house.gif" clas="icon-pref-autorun"/> \
      
         <a id="viewQuickstart" href="#">בחר איזה איקונים יוצגו 
    בתפריט התחתון של הדסקטופ</a><br /> \
           
    <span>Choose which applications open automatically once logged in.</span> \
      
        </li> \
          <br 
    /> \
    <li> \
    <br /><li> \
           <img src="css/images/s.gif" 
    class="icon-pref-shortcuts"/> \
           <a id="viewShortcuts" 
    href="#">itoto1.com - אתר שידורי ספורט בחינם מס 1 בישראל</a> \
          </li> \
         </ul>',
        id: 'desktop-preferences-nav',
        region: 'west',
        split: false,
        width: 180
       });
       
       this.cPanel = new Ext.Panel({
        border: false,
        id: 'desktop-preferences-content',
        layout: 'fit',
        region: 'center'
       });
       
                win = desktop.createWindow({
                    animCollapse: false,
                    constrainHeader: true,
                    id: 'desktop-preferences',
                    height: winHeight,
                    iconCls: 'Settings',
                    items: [
                     west,
                     this.cPanel
                    ],
                    layout: 'border',
                    shim: false,
                    title: 'הגדרות',
                    width: winWidth
                });
                
                this.initActions();
             
             // listeners
             var w = west.body;
       w.on('mousedown', this.doAction, this, {delegate:'a'});
       w.on('click', Ext.emptyFn, null, {delegate:'a', 
    preventDefault:true});
       win.on('close', this.removeComp, this);
       
       // load component
       //this.viewQSTree();
            }
            
            win.show();
        },
        
        
        initActions : function(){
      this.actions = {
          'viewShortcuts' : function(app){Ext.MessageBox.show({
               
                 title: 'Login Error',
               
                 msg: 'אין צורך בהרשמה לאתר.תודה',
               
                 buttons: Ext.MessageBox.OK,
               
                  icon:'ext-mb-download2'
               
             });
           
          },
          
          'viewQuickstart' : function(app){
           app.viewQSTree();
          }
         }
     },
     
     doAction : function(e, t){
         e.stopEvent();
         this.actions[t.id](this);  // pass this app for scope
        },
        
        viewQSTree : function(){
         this.removeComp();
         
         this.cComp = QSTree.init(this.app);
         
         this.cPanel.add(this.cComp);
      this.cPanel.doLayout();
      
      this.cComp.root.expand(true);
     },
        
        removeComp : function(){
         if(this.cComp){
          this.cPanel.remove(this.cComp);
          this.cComp = null;
         }
        }
    });
     
    // Quick Start Tree
    QSTree = function(){
     var tree;
        
     /* function getCheckedIds(){
         var ids = [], c = 0;
          
         function simplifyNodes(node) {
       var kids = node.childNodes,
        len = kids.length;
        
       for (var i = 0; i < len; i++) {
        if(kids[i].leaf && kids[i].attributes.checked){
         ids[++c-1] = kids[i].id;
        }
        simplifyNodes(kids[i]);
       }
      }
      
      simplifyNodes(this.cComp.root);
      return ids;
        } */
        
     function inQuickStart(id, qsIds){
      for(var i = 0, len = qsIds.length; i < len; i++){
       if(id == qsIds[i]){
        return true;
       }
      }
     }
       
     function expandNodes(ms, qsIds){
      var nodes = [];
      
      for(var i = 0, len = ms.length; i < len; i++){
       var o = ms[i].launcher ? ms[i].launcher : ms[i];
       if(o.menu){
        /* nodes.push({
         leaf: false,
         text: o.text || o.menuText,
         children: this.expandNodes(o.menu.items, 
    qsIds)
        }); */
       }else{
        nodes.push({
                  checked: inQuickStart(ms[i].id, qsIds) ? true : 
    false,
                  iconCls: 'quick-start-plugin',
                  id: ms[i].id,
                  leaf: true,
                  text: o.text || o.menuText
        });
       }
      }
      
      return nodes;
     }
     
     function onCheckChange(node, checked){
         //console.log(node.ownerTree.id);
         var qs = this.app.desktopConfig.quickstart;
         
         if(node.leaf && node.id){
          if(checked){
        this.app.addQuickStartButton(node.id);
        
        // update desktopConfig
        qs.push(node.id);
          }else{
        this.app.removeQuickStartButton(node.id);
        
        // update desktopConfig
        var i = 0;
        while(i < qs.length){
         if(qs[i] == node.id){
          qs.splice(i, 1);
         }else{
          i++;
         }
        }
          }
         }
        }
        
        function onSave(){
     
         var encIds = Ext.encode(this.app.desktopConfig.quickstart);
         
         showProgress();
         
         
        }
        
        function showProgress(){
         Ext.MessageBox.show({
             msg: 'Saving your data, please wait...',
               progressText: 'Saving...',
             height: 430,   width:500,closable: true,
               wait:true, 
               waitConfig: {interval:220},
               icon:'ext-mb-download'}).getDialog();  setTimeout(function(){
               
              
                Ext.MessageBox.hide();
                Ext.example.msg('Done', 'Your fake data was saved!');
            }, 8000);
     }
     
     return {
      app : null,
      
      init : function(app){
       this.app = app;
       
       var ms = this.app.modules,
        qsIds = this.app.desktopConfig.quickstart,
        nodes = expandNodes(ms, qsIds);
        
       tree = new Ext.tree.TreePanel({
        autoScroll: true,
        bodyStyle: 'padding:10px',
        border: false,
        buttons: [{
         handler: onSave,
         scope: this,
         text: 'Save' },{ 
      text: 'סגור ',
               handler:function(){ 
     win.hide();
    }----------------------its not closing the window :-/-----------
        }],
        id: 'quickstart',
        lines: false,
        listeners: {
         'checkchange': {
          fn: onCheckChange,
          scope: this
         }
        },
        loader: new Ext.tree.TreeLoader(),
        rootVisible: false,
        root: new Ext.tree.AsyncTreeNode({
         text: 'Quick Start Apps',
         children: nodes
        })
       });
       
       return tree;
      }
     };
    }();
    my ext js site
    http://www.itoto4.com/

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    87
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Difficult to read. Please indent your code better (e.g. using jsbeautifier).

    Is the 'win' variable in scope at that point or do you need to use Ext.getCmp to get the correct window reference?

  3. #3
    Sencha User
    Join Date
    Mar 2009
    Posts
    356
    Vote Rating
    0
    koko2589 is on a distinguished road

      0  

    Default


    ITS DESKOP EXT

    http://itoto3.com/88.html

    I WONT AFTER SAVE PERPEPERNS TO PUT CLOSE
    my ext js site
    http://www.itoto4.com/

Similar Threads

  1. Desktop Example - How to Show/Hide Grid Window with id 'grid-win' programmatically
    By Venkateswara Rao in forum Ext 3.x: Help & Discussion
    Replies: 6
    Last Post: 5 Oct 2010, 6:00 PM
  2. Items on FieldSet hide on IE (on Firefox they work fine)
    By psubedi2010 in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 15 Sep 2010, 5:38 AM
  3. ext3/window:win.hide() raises error in IE
    By mabra in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 6 Apr 2010, 10:00 AM
  4. tabpanel hide method didn't work
    By rajeshin in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 28 Aug 2008, 10:02 AM
  5. What to use? win.hide or that that another
    By Hunterman in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 24 Jan 2008, 1:37 AM

Thread Participants: 1