1. #1
    Sencha User poojagarg89's Avatar
    Join Date
    Sep 2011
    Location
    Ahmedabad,India
    Posts
    213
    Vote Rating
    0
    poojagarg89 is on a distinguished road

      0  

    Default Menu Items in Ext.menu.Menu getting replicated and doubled.....again n again

    Menu Items in Ext.menu.Menu getting replicated and doubled.....again n again


    I have a TreePanel on which I am using Ext.menu.Menu on right click of TreeNodes.............when I close window and open again the Menu Items get replicated and doubled
    ex : Have a look on Screenshots

    1.jpg

    Now, when I click on Cancel button and open this popup Window again see how it comes.........

    2.jpg


    How I can resolve this Issue I am not able to understand............?


    help me.......!!!

    Thanks n Regards,
    Pooja

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    52
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    Without seeing any example code it's impossible to diagnose.

    However, it's obvious that you must have some logic firing when showing/hiding the window/treemenu which populates a store. This store is obviously getting updated to include the records again (and again, and again), rather than creating the store afresh, or just leaving the store data unchanged...

  3. #3
    Sencha User poojagarg89's Avatar
    Join Date
    Sep 2011
    Location
    Ahmedabad,India
    Posts
    213
    Vote Rating
    0
    poojagarg89 is on a distinguished road

      0  

    Default


    yeah m reloading the store for TreeLoader many times n on some conditions I am hiding/showing some Menu Items of TreeMenu........

    here is code :
    Code:
    function search_pointMaintenance_fn(){                                // Search Point Maintenance
        
        var search_pointMaintenance_form;
        var search_pointMaintenance_loader;
        var search_pointMaintenance_root;
        var search_pointMaintenance_panel;
        var search_pointMaintenance_win;
        var search_pointMaintenance_conn;
        var search_pointMaintenance_ds;
        
        Ext.app.search_pointMaintenanceLoader = Ext.extend(Ext.ux.XmlTreeLoader, {
                processAttributes : function(attr){
                if(attr.template_name){ 
                     attr.text = attr.template_name;
                     attr.id = attr.template_id;
                     attr.iconCls="child_folder";
                     attr.loaded = true;
                }else if(attr.group_name){ 
                     attr.text = attr.group_name;
                     attr.id = attr.group_id;
                     attr.loaded = true;
                }else if(attr.subgroup_name){ 
                     attr.text = attr.subgroup_name;
                     attr.id = attr.subgroup_id;
                     attr.loaded = true;
                }       
            }
        });            
    
        
     search_pointMaintenance_loader =new Ext.app.search_pointMaintenanceLoader({
        id:"search_pointMaintenance_loader_id",
        dataUrl:projname+'/ShowSearchPointsTree'
     });
         
         
        search_pointMaintenance_root = new Ext.tree.AsyncTreeNode({
            text:'Search Point Type',
            id:'search_pointMaintenance_id',
            expanded:true,
            iconCls:"parent_folder",
            loader:search_pointMaintenance_loader
        })
    
        search_pointMaintenance_panel = new Ext.tree.TreePanel({
            id: 'search_pointMaintenance_panel',
            border:false,
            collapsible: false,
            autoScroll: true,
            enableDD:false,
            rootVisible: true,
            height: 460,
            lines: true,
            layout:"fit",
            root:search_pointMaintenance_root,
            listeners:{
                click: function(node,e){
                    var spm_id = node.id;
                    var spm_txt = node.text;
                    if(node.text=="Search Point Type"){
                        Ext.getCmp("ctxaddbtn").hide();
                         Ext.getCmp("ctxeditbtn").hide();
                         Ext.getCmp("ctxdeletebtn").hide();
    /*                    Ext.getCmp("spmupdatebtn").hide();
                        Ext.getCmp("spmrsetbtn").show();
                        Ext.getCmp("spmcreatebtn").show();
                        Ext.getCmp("spmedittbar").hide();
                        Ext.getCmp("spmdeletetbar").hide();
                        Ext.getCmp("search_point_type").reset();
                        Ext.getCmp("search_point_parent").setValue("None");
                        Ext.getCmp("can_have_inventories").setValue(false);
                        Ext.getCmp("spm_required").setValue(false);
                        Ext.getCmp("spm_multi_select").setValue(false);
    */                }else if(node.parentNode.parentNode){
                        if(node.parentNode.parentNode.text=="Search Point Type")
                        {
                            if(spm_id.indexOf("leaf")!=-1){
                                Ext.getCmp("ctxaddbtn").hide();
                                 Ext.getCmp("ctxeditbtn").show();
                                 Ext.getCmp("ctxdeletebtn").show();
                            }else if(spm_id.indexOf("template")!=-1){
                                Ext.getCmp("ctxaddbtn").show();
                                Ext.getCmp("ctxeditbtn").hide();
                                Ext.getCmp("ctxdeletebtn").hide();
                            }else{
                                Ext.getCmp("ctxaddbtn").show();
                                 Ext.getCmp("ctxeditbtn").show();
                                 Ext.getCmp("ctxdeletebtn").show();
                            }
                            /*Ext.getCmp("spmupdatebtn").show();
                            Ext.getCmp("spmrsetbtn").hide();
                            Ext.getCmp("spmcreatebtn").hide();
                            Ext.getCmp("spmedittbar").show();
                            Ext.getCmp("spmdeletetbar").show();
                            Ext.getCmp("search_point_type").setValue(node.text);
                            Ext.getCmp("search_point_parent").setValue(node.parentNode.text);
                            Ext.getCmp("can_have_inventories").setValue(false);
                            Ext.getCmp("spm_required").setValue(true);
                            Ext.getCmp("spm_multi_select").setValue(true);*/
                         }else{
                             if(spm_id.indexOf("leaf")!=-1){
                                Ext.getCmp("ctxaddbtn").hide();
                                 Ext.getCmp("ctxeditbtn").show();
                                 Ext.getCmp("ctxdeletebtn").show();
                            }else if(spm_id.indexOf("template")!=-1){
                                Ext.getCmp("ctxaddbtn").show();
                                Ext.getCmp("ctxeditbtn").hide();
                                Ext.getCmp("ctxdeletebtn").hide();
                            }else{
                                Ext.getCmp("ctxaddbtn").show();
                                 Ext.getCmp("ctxeditbtn").show();
                                 Ext.getCmp("ctxdeletebtn").show();
                            }
                             
                             /*Ext.getCmp("spmupdatebtn").show();
                            Ext.getCmp("spmrsetbtn").hide();
                            Ext.getCmp("spmcreatebtn").hide();
                            Ext.getCmp("spmedittbar").show();
                            Ext.getCmp("spmdeletetbar").show();
                            Ext.getCmp("search_point_type").setValue(node.text);
                            Ext.getCmp("search_point_parent").setValue(node.parentNode.text);
                            Ext.getCmp("can_have_inventories").setValue(true);
                            Ext.getCmp("spm_required").setValue(false);
                            Ext.getCmp("spm_multi_select").setValue(true);*/
                         }
                     }else if(node.parentNode){
                       if(node.parentNode.text=="Search Point Type")
                       {
                               if(spm_id.indexOf("leaf")!=-1){
                                Ext.getCmp("ctxaddbtn").hide();
                                 Ext.getCmp("ctxeditbtn").show();
                                 Ext.getCmp("ctxdeletebtn").show();
                            }else if(spm_id.indexOf("template")!=-1){
                                Ext.getCmp("ctxaddbtn").show();
                                Ext.getCmp("ctxeditbtn").hide();
                                Ext.getCmp("ctxdeletebtn").hide();
                            }else{
                                Ext.getCmp("ctxaddbtn").show();
                                 Ext.getCmp("ctxeditbtn").show();
                                 Ext.getCmp("ctxdeletebtn").show();
                            }
                               /*Ext.getCmp("spmupdatebtn").show();
                            Ext.getCmp("spmrsetbtn").hide();
                            Ext.getCmp("spmcreatebtn").hide();
                            Ext.getCmp("spmedittbar").show();
                            Ext.getCmp("spmdeletetbar").show();
                            Ext.getCmp("search_point_type").setValue(node.text);
                            Ext.getCmp("search_point_parent").setValue("None");
                            Ext.getCmp("can_have_inventories").setValue(false);
                            Ext.getCmp("spm_required").setValue(true);
                            Ext.getCmp("spm_multi_select").setValue(true);*/
                       }else{
                               if(spm_id.indexOf("leaf")!=-1){
                                Ext.getCmp("ctxaddbtn").hide();
                                 Ext.getCmp("ctxeditbtn").show();
                                 Ext.getCmp("ctxdeletebtn").show();
                            }else if(spm_id.indexOf("template")!=-1){
                                Ext.getCmp("ctxaddbtn").show();
                                Ext.getCmp("ctxeditbtn").hide();
                                Ext.getCmp("ctxdeletebtn").hide();
                            }else{
                                Ext.getCmp("ctxaddbtn").show();
                                 Ext.getCmp("ctxeditbtn").show();
                                 Ext.getCmp("ctxdeletebtn").show();
                            }
                               /*Ext.getCmp("spmupdatebtn").show();
                            Ext.getCmp("spmrsetbtn").hide();
                            Ext.getCmp("spmcreatebtn").hide();
                            Ext.getCmp("spmedittbar").show();
                            Ext.getCmp("spmdeletetbar").show();
                            Ext.getCmp("search_point_type").setValue(node.text);
                            Ext.getCmp("search_point_parent").setValue(node.parentNode.text);
                            Ext.getCmp("can_have_inventories").setValue(false);
                            Ext.getCmp("spm_required").setValue(true);
                            Ext.getCmp("spm_multi_select").setValue(true);*/
                       }
                     }
                }
            }
        });
        
        search_pointMaintenance_root.on('expand',function(){
            search_pointMaintenance_panel.getSelectionModel().select(search_pointMaintenance_root);
            //Ext.getCmp("search_point_parent").setValue("None");
        });
        
        search_pointMaintenance_panel.on('contextmenu', createContext);
    
    function search_point_add_fn(record){
    
       var search_point_add_form=new Ext.form.FormPanel({
            id:'search_point_add_form',
             labelWidth:120,
            autoScroll:true,
            frame:true,
            items:[{
                    xtype:"textfield",
                    fieldLabel:"",
                    labelSeparator:"",
                    hidden:true
            },{
              xtype:"textfield",
              id:"search_point_name",
              fieldLabel:"Search Point Name",
              //layout : 'form',
              mode:'local',
              padding:"20 0 0 20",          
              allowBlank:false,
              blankText:"This field is required",
              msgTarget:"under"
            }]
            });
            
        if(record=="edit")    
        {
            var rec = Ext.getCmp("search_pointMaintenance_panel").getSelectionModel().getSelectedNode(); 
            Ext.getCmp("search_point_name").setValue(rec.text);
         }
         
       var search_point_add_win=new Ext.Window({
            id:'search_point_add_win',
            layout:'fit',
            title:"Search Point Form",
            width:330,
            height:150,
            closable: true,
            closeAction:'close',
            minimizable:false,
            resizable:false,
            modal: true,
            items:[search_point_add_form],
            buttons:[{
             text:"Add",
             id:"add_btn",
             handler:function(){
                 
                 if(search_point_add_form.getForm().isValid())
                 {
                var rec = Ext.getCmp("search_pointMaintenance_panel").getSelectionModel().getSelectedNode(); 
                var spt_id = rec.id;
                var search_point_name = Ext.getCmp('search_point_name').getValue();
    
                var node = Ext.getCmp("search_pointMaintenance_panel").getSelectionModel().getSelectedNode(); 
                    var spt_type_dsvalue;
                    for(var i=0;i<node.childNodes.length;i++){
                        spt_type_dsvalue = node.childNodes[i].text;
                        if(search_point_name.toLowerCase()===spt_type_dsvalue.toLowerCase())
                        {
                          Ext.Msg.alert("Error","Sorry! Search Point already exists.");
                          return false;
                        }    
                    }
                        Ext.Ajax.request({
                         url:projname+"/mediator",
                            success: function(response){
                                Ext.Msg.alert("Success","Search Point added successfully");
                                        search_pointMaintenance_root.reload(function(response,success,option){
                                            Ext.getCmp("search_pointMaintenance_panel").expandAll();
                                        });
                                    },params:{operation:"createSearchPoints",nextpage:"/web/jsp/wh_homepage.jsp",spt_parent_id:spt_id,search_point_name:search_point_name}
                                });
                        search_points_ds.load();        
                       search_point_add_win.close();
                }
                else
                  Ext.Msg.alert("Success","Please enter required field");
             }
               
            },{
             text:"Update",
             id:"update_btn",
             handler:function(){
                 if(search_point_add_form.getForm().isValid())
                 {
                var rec = Ext.getCmp("search_pointMaintenance_panel").getSelectionModel().getSelectedNode(); 
                var spt_id = rec.id;
                var search_point_name = Ext.getCmp('search_point_name').getValue();
                var s="";
                for(var i=0;i<search_points_ds.getCount();i++)
                {
                       s = search_points_ds.getAt(i).data.name;
                       if(s===search_point_name)
                       {
                           Ext.Msg.alert("Error","Search Point name already exists");
                        return false;
                       } 
                }
                        Ext.Ajax.request({
                         url:projname+"/mediator",
                            success: function(response){
                                Ext.Msg.alert("Success","Search Point updated successfully");
                                        search_pointMaintenance_root.reload(function(response,success,option){
                                            Ext.getCmp("search_pointMaintenance_panel").expandAll();
                                        });
                                    },params:{operation:"updateSearchPoints",nextpage:"/web/jsp/wh_homepage.jsp",spt_parent_id:spt_id,search_point_name:search_point_name}
                                });
                       search_point_add_win.close();
                }
             else
                 Ext.Msg.alert("Success","Please enter required field");
             }
            },{
             text:"Cancel",
             handler:function(){
                search_point_add_win.close();
             }
            }] 
            
       });
       search_point_add_win.show();
      }
                 
        
    var ctxMenu = new Ext.menu.Menu({
        id:'copyCtx',
        items: [
            {
                //id:'add',
                iconCls:"add",
                id:"ctxaddbtn",
                text:'Add',
                handler:function(){
                    search_point_add_fn("add");
                    Ext.getCmp("update_btn").hide();
                    /*spm_txt="new";
                    Ext.getCmp("spmupdatebtn").hide();
                    Ext.getCmp("spmrsetbtn").show();
                    Ext.getCmp("spmcreatebtn").show();*/
                }
            },{
                //id:'edit',
                iconCls:"edit",
                id:"ctxeditbtn",
                text:'Edit',
                handler: function(){
                    //alert("edit");
                    search_point_add_fn("edit");
                    Ext.getCmp("add_btn").hide();
                    
                    /*spm_txt="edit";
                    Ext.getCmp("spmupdatebtn").show();
                    Ext.getCmp("spmrsetbtn").hide();
                    Ext.getCmp("spmcreatebtn").hide();*/
                }
            },
            {
                //id:'delete',
                iconCls:"delete",
                id:"ctxdeletebtn",
                text:'Delete',
                handler: function(){
                var rec = Ext.getCmp("search_pointMaintenance_panel").getSelectionModel().getSelectedNode(); 
                var spt_id = rec.id;
                Ext.Msg.confirm('Confirm', 'Are you sure, you want to delete this search point?',function(btn,text){
                 if(btn == 'yes'){
                    Ext.Ajax.request({
                         url:projname+"/mediator",
                            success: function(response){
                                var res = response.responseText;
                                if(res=="failure")
                                {
                                    Ext.Msg.alert("Error","You cannot delete this search point.");
                                    return false;
                                 }
                                Ext.Msg.alert("Success","Search Point deleted successfully");
                                   search_pointMaintenance_root.reload(function(response,success,option){
                                    Ext.getCmp("search_pointMaintenance_panel").expandAll();
                                });
                            },params:{operation:"deleteSearchPoints",nextpage:"/web/jsp/wh_homepage.jsp",spt_parent_id:spt_id}
                        });
                     }
                  });
                }
            }
        ]
    });
    
    function createContext(node, e){
        ctxMenu.show(node.ui.getAnchor());
    } 
        
        
        search_pointMaintenance_form = new Ext.form.FormPanel({
            id: "search_pointMaintenance_form",        
            layout:"border",
            autoScroll: true,
            items:[{
                region:'west',
                border:true,
                hideMode:'offsets',
                width: 210,
                layout:'fit',
                items: [search_pointMaintenance_panel]
            },{
                region: "center",
                border:true,
                layout:"fit",
                hideMode:'offsets'
    
        }]
        });
        
        search_pointMaintenance_win = new Ext.Window({
            id:'search_pointMaintenance_win',
            layout:'fit',
            title:"Search Point Maintenance",
            width:750,
            height:530,
            closable: true,
            closeAction:'close',
            resizable:true,
            modal: true,
            items:[search_pointMaintenance_form],
            buttons:[{
                text:"Cancel",
                handler: function(){
                    search_pointMaintenance_win.close();
                }
            }]
        });
        search_pointMaintenance_win.show();
        
    }

    try this code.........this is the full code for the Window which I gave in image in my previous post.

    Regards,
    Pooja

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi