1. #1
    Banned
    Join Date
    Jan 2008
    Posts
    120
    Vote Rating
    0
    israel is on a distinguished road

      0  

    Question data view on desktop workig good 1 time after not working what haapend?

    data view on desktop workig good 1 time after not working what haapend?


    ferst time its working good but when i close it and open again its not shoing the data view
    Code:
      
      var lookup = {};
    
        var siteData = [
         
      ['http://youtube.com','img24.jpg','youtube' ], 
     ['http://youtube.com','desktop115411.jpg','youtube' ],
      ['http://youtube.com','desktop181.jpg','youtube' ],
     
      
    
            ['http://google.co.jp','desktop1111.png','google'],
    
            ['http://google.co.jp','desktop1111.png','google' ],
            ['http://yahoo.co.jp','648217_medium.jpg','yahoo'],
            ['http://extjs.com','http://capture.heartrails.com/small?http://extjs.com','extjs'],
            ['http://capture.heartrails.com','http://capture.heartrails.com/small?http://capture.heartrails.com','heartrails' ],
            ['http://yahoo.co.jp','648217_medium.jpg','yahoo'],
            ['http://extjs.com','http://capture.heartrails.com/small?http://extjs.com','extjs'],
            ['http://capture.heartrails.com','http://capture.heartrails.com/small?http://capture.heartrails.com','heartrails' ],
            ['http://youtube.com','../../resources/themes/xtheme-olive/xtheme-olive.png','youtube' ]
        ];
    
        var store = new Ext.data.SimpleStore({
            fields: [
               { name: 'siteurl'},
               { name: 'imgurl' },
               { name: 'name'   }
            ],
            data : siteData
        });
    
        var formatData = function( data ){
            lookup[ data.name ] = data;
            return data;
        };
    
        var view = new Ext.DataView({
            tpl: new Ext.XTemplate(
                '<tpl for=".">',
                    '<div class="thumb-wrap" id="{name}">',
                    '<div class="thumb"><img src="{imgurl}" title="{name}"></div>',
                    '<span>{name}</span>',
                    '</div>',
                '</tpl>'
            ),
            singleSelect: true,
            overClass:'x-view-over',
            itemSelector: 'div.thumb-wrap',
            store: store,
            listeners: {
                'click':{
                    fn:function(){
                        var selNode = view.getSelectedNodes()[0];
                        var data = lookup[selNode.id];
                        location.href=data.siteurl;
                    }
                }
            },
            prepareData: formatData.createDelegate(this)
        });
    
    MyDesktop.TeamspeakModule = Ext.extend(Ext.app.Module, {
    	appType : 'Teamspeak',
        id : 'teamspeak-win',
        
        init : function(){
            this.launcher = {
                text: 'data view',
                iconCls:'ts',
                handler : this.createWindow,
                scope: this
            }
        },
    	
    	    createWindow : function(){
            var desktop = this.app.getDesktop();
            var win = desktop.getWindow('teamspeak-win');
            if(!win){
    			MyDesktop.getDim();
                win = desktop.createWindow({
                    id: 'teamspeak-win',
                    title:'data view', buttonAlign:'center',
                    
                    height:480,   width:620,x:140,y:40,
                   
                    iconCls: 'ts',
                    shim:false,
                    animCollapse:false,
                    layout: 'fit',
                    border:false,
                    constrainHeader:true, 	 id: 'img-chooser-view',   autoScroll: true, 
    bodyStyle:"padding:5px",
            items:view,	
                   buttons: [{
    		             text: 'close ',
    		          handler: function(){win.close();}
    		   }]
    
                });
            }
            win.show();
        }
    });

  2. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,361
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    your view is being destroyed it seems. you need to instantiate a new instance of view every time you re-open the window.

    are you familiar with OO JS?

  3. #3
    Banned
    Join Date
    Jan 2008
    Posts
    120
    Vote Rating
    0
    israel is on a distinguished road

      0  

    Default


    yes i need to refresh the page evry time how can i fix it?

  4. #4
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,361
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    maybe - Build a factory method that creates a new view?!

  5. #5
    Banned
    Join Date
    Jan 2008
    Posts
    120
    Vote Rating
    0
    israel is on a distinguished road

      0  

    Default


    Quote Originally Posted by jgarcia@tdg-i.com View Post
    maybe - Build a factory method that creates a new view?!
    how?

  6. #6
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    6
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default


    I don't understand all of your code's context, but you could go something like this. Is that listener you have configured actually working?

    Code:
        var view = new Ext.DataView({
            tpl: new Ext.XTemplate(
                '<tpl for=".">',
                    '<div class="thumb-wrap" id="{name}">',
                    '<div class="thumb"><img src="{imgurl}" title="{name}"></div>',
                    '<span>{name}</span>',
                    '</div>',
                '</tpl>'
            ),
            singleSelect: true,
            overClass:'x-view-over',
            itemSelector: 'div.thumb-wrap',
            store: store,
            listeners: {
                'click':{
                    fn:function(){
                        var selNode = view.getSelectedNodes()[0];
                        var data = lookup[selNode.id];
                        location.href=data.siteurl;
                    }
                }
            },
            prepareData: formatData.createDelegate(this)
        });
    
    MyDesktop.TeamspeakModule = Ext.extend(Ext.app.Module, {
    	appType : 'Teamspeak',
        id : 'teamspeak-win',
        
        init : function(){
            this.launcher = {
                text: 'data view',
                iconCls:'ts',
                handler : this.createWindow,
                scope: this
            }
        },
    
        createWindow : function(){
            var desktop = this.app.getDesktop();
    
            var win = desktop.getWindow('teamspeak-win');
    
            if(!win){
    
                MyDesktop.getDim();
    
        var view= new Ext.DataView({
            tpl: new Ext.XTemplate(
                '<tpl for=".">',
                    '<div class="thumb-wrap" id="{name}">',
                    '<div class="thumb"><img src="{imgurl}" title="{name}"></div>',
                    '<span>{name}</span>',
                    '</div>',
                '</tpl>'
            ),
            singleSelect: true,
            overClass:'x-view-over',
            itemSelector: 'div.thumb-wrap',
            store: store,
            listeners: {
                'click':{
                    fn:function(){
                        var selNode = view.getSelectedNodes()[0];
                        var data = lookup[selNode.id];
                        location.href=data.siteurl;
                    }
                }
            },
            prepareData: formatData.createDelegate(this)
        });
    
                win = desktop.createWindow({
                    id: 'teamspeak-win',
                    title:'data view', buttonAlign:'center',
                    
                    height:480,   width:620,x:140,y:40,
                   
                    iconCls: 'ts',
                    shim:false,
                    animCollapse:false,
                    layout: 'fit',
                    border:false,
                    constrainHeader:true, 	 id: 'img-chooser-view',   autoScroll: true, 
    bodyStyle:"padding:5px",
            items:view,	
                   buttons: [{
    		             text: 'close ',
    		          handler: function(){win.close();}
    		   }]
    
                });
            }
            win.show();
        }
    });

  7. #7
    Banned
    Join Date
    Jan 2008
    Posts
    120
    Vote Rating
    0
    israel is on a distinguished road

      0  

    Default


    Quote Originally Posted by mjlecomte View Post
    I don't understand all of your code's context, but you could go something like this. Is that listener you have configured actually working?

    Code:
        var view = new Ext.DataView({
            tpl: new Ext.XTemplate(
                '<tpl for=".">',
                    '<div class="thumb-wrap" id="{name}">',
                    '<div class="thumb"><img src="{imgurl}" title="{name}"></div>',
                    '<span>{name}</span>',
                    '</div>',
                '</tpl>'
            ),
            singleSelect: true,
            overClass:'x-view-over',
            itemSelector: 'div.thumb-wrap',
            store: store,
            listeners: {
                'click':{
                    fn:function(){
                        var selNode = view.getSelectedNodes()[0];
                        var data = lookup[selNode.id];
                        location.href=data.siteurl;
                    }
                }
            },
            prepareData: formatData.createDelegate(this)
        });
    
    MyDesktop.TeamspeakModule = Ext.extend(Ext.app.Module, {
    	appType : 'Teamspeak',
        id : 'teamspeak-win',
        
        init : function(){
            this.launcher = {
                text: 'data view',
                iconCls:'ts',
                handler : this.createWindow,
                scope: this
            }
        },
    
        createWindow : function(){
            var desktop = this.app.getDesktop();
    
            var win = desktop.getWindow('teamspeak-win');
    
            if(!win){
    
                MyDesktop.getDim();
    
        var view= new Ext.DataView({
            tpl: new Ext.XTemplate(
                '<tpl for=".">',
                    '<div class="thumb-wrap" id="{name}">',
                    '<div class="thumb"><img src="{imgurl}" title="{name}"></div>',
                    '<span>{name}</span>',
                    '</div>',
                '</tpl>'
            ),
            singleSelect: true,
            overClass:'x-view-over',
            itemSelector: 'div.thumb-wrap',
            store: store,
            listeners: {
                'click':{
                    fn:function(){
                        var selNode = view.getSelectedNodes()[0];
                        var data = lookup[selNode.id];
                        location.href=data.siteurl;
                    }
                }
            },
            prepareData: formatData.createDelegate(this)
        });
    
                win = desktop.createWindow({
                    id: 'teamspeak-win',
                    title:'data view', buttonAlign:'center',
                    
                    height:480,   width:620,x:140,y:40,
                   
                    iconCls: 'ts',
                    shim:false,
                    animCollapse:false,
                    layout: 'fit',
                    border:false,
                    constrainHeader:true, 	 id: 'img-chooser-view',   autoScroll: true, 
    bodyStyle:"padding:5px",
            items:view,	
                   buttons: [{
    		             text: 'close ',
    		          handler: function(){win.close();}
    		   }]
    
                });
            }
            win.show();
        }
    });
    tankyou gad blesyou now its working
    תזכה למצוות