about toolbar menu

  1. #1

    about toolbar menu

    Dear All,
    I have menu in toolbar,I bind this menu from database ,when i retrieve data for the first time from database in "page_load" time the menu load correct data
    from database table , But i don't want from the user to make refresh for all the page for every change on database table to reload the data to this
    menu ,so i put refresh button to let him refresh only this menu but the problem, In server side the code bring the correct data that i want, But the change doesn't appear on the menu , I saw the refresh button for tree in your examples you put ("initChildren()") in Clint Side for the refresh to make the change on
    the tree so do i want to have like this function on menu to do the change on menu for every change

    i used the inititems() and initeCompnent() and dolayout() but i didn't have any thing


    pleas help
  2. #2
    Dear All ,
    please If u could answer on this my Q ,I'll be thanks,Really I want to it my work
  3. #3
    Hi,

    You have to rerender button with menu
    mybutton.Render();
  4. #4
    dear,
    i use your example https://examples1.ext.net/#/TreePane...h_Static_Tree/.

    when i clickon refresh
    <Tools>            
                    <ext:Tool Type="Refresh" Qtip="Refresh" Handler="refreshTree(#{TreePanel1});" />
                </Tools>
    i want to update the menu with the tree , the tree is updated but the menu doesn't update the reason behind update the tree because i use,
    tree.initChildren(nodes);
    so if u code please can u tell me what is the function that update menu in client side like the function update the tree,
    For me i know that my problem only for rendering the menu but i don't know what function can i used, Because everything is correct on server side

    thanx in advance
  5. #5
    I am not sure how the tree and the menu are related between each other?
    Please post test sample for testing
  6. #6
    this is my aspx
     <Items>
                         <ext:Button ID="btnMovetomyfolders" runat="server" Icon="BasketAdd" Text="نقل البريد الى">
                                <Menu>
                                  <ext:Menu ID="menMovetomyfolders" runat="server">
                                    <Items>
                                        <ext:MenuItem  ID="miMovetomyfolders" AutoRender="true"  runat="server" Icon="Add" Text="مجلداتي " Hidden="true">
                                            <Listeners>
                                                <Click Fn="MoveMailsToFolders" />
                                            </Listeners>
                                        </ext:MenuItem>
                                    </Items>
                                  </ext:Menu>
                                </Menu>
                            </ext:Button>
     <ext:Panel ID="pnMyFolders" 
                            runat="server" 
                            Title="مجلداتي" 
                            Border="false" 
                            Padding="6"
                             MaxHeight="200"
                            Icon="FolderExplore"
                           IDMode="Static"
                           AutoScroll="true"
                            >
                             <Tools>
                 <ext:Tool Type="Refresh" Qtip="MyFolders" Fn="updateEmployeeProceeFolders"  />
           
                            </Tools>
                            <Items>
                <ext:TreePanel 
                ID="tpMyFolders" 
                IDMode="Static"
                runat="server" 
                Icon="Anchor"
                Header="false"
                AutoScroll="true" 
                Width="250" 
                Collapsed="False" 
                CollapseFirst="True"
                RootVisible="false" 
                HideParent="False"
                BodyStyle="padding-left:10px">
              <Listeners>
              <Click Fn="selectNode" />
              </Listeners>
             </ext:TreePanel>
             </Items>
                            </ext:Panel>
    this is my code on server side and it work correctly
     [DirectMethod]
        public string BuildTree( string treename, int x)
        {
            Ext.Net.TreeNodeCollection nodes = new Ext.Net.TreeNodeCollection();
            nodes = treename.CompareTo("tpMyFolders") == 0 ? tpMyFolders.Root : tpCtsEmployeeFolders.Root;
            try
            {
                //Ext.Net.TreeNodeCollection nodes = new Ext.Net.TreeNodeCollection();
                //nodes = treename.CompareTo("tpMyFolders") == 0 ? tpMyFolders.Root : tpCtsEmployeeFolders.Root;
                EmployeesFolders employeefolder = new EmployeesFolders();
                employeefolder.Employee_ID = (Session["Employee"] as List<Employees>)[0].Employee_ID;
                employeefolder.Employee_Folder_IsGeneral = x == 2 ? false : true;
    
                employeeFolderlist = EmployeesFoldersDB.GetList(employeefolder);
    
                if (nodes == null)
                {
                    nodes = new Ext.Net.TreeNodeCollection();
                }
    
                Ext.Net.TreeNode root = new Ext.Net.TreeNode();
                root.Text = "مجلداتي";
                root.NodeID = "-1";
                nodes.Add(root);
    
    
    
                foreach (var item in employeeFolderlist)
                {
    
                    Ext.Net.TreeNode node = new Ext.Net.TreeNode();
                    node.NodeID = item.Employee_Folder_ID.ToString();
                    node.Text = item.Employee_Folder_Name;
                    node.Icon = Icon.Folder;
                    root.Nodes.Add(node);
                    menMovetomyfolders.AutoDoLayout = true;
                    
                    if (x != 2)
                    {   
                        Ext.Net.MenuItem mI = new Ext.Net.MenuItem(node.Text);
                        mI.ID = node.NodeID;
                        mI.Icon = Icon.Add;
                        mI.Listeners.Click.Fn = "MoveMailsToFolders";
                        menMovetomyfolders.Add(mI);
    
                        
                    }
                }
               
            }
            catch (Exception ex)
            {
    
                return ex.Message;
            }
    
    
    
            return nodes.ToJson() ;
        }
    this is my JS code
    var loadingMsg="جاري التحميل"
    function updateEmployeeProceeFolders(sender) {
    
       
            if (sender.target.qtip == 'CTSEmployee') {
                Ext.net.DirectMethods.BuildTree(tpCtsEmployeeFolders.id, 2, { success: function (result) {
                    var nodes = eval(result);
                    tpCtsEmployeeFolders.initChildren(nodes)
        }
        , eventMask: {
            showMask: true, msg: loadingMsg
        }
        });
            }
            else {
                Ext.net.DirectMethods.BuildTree(tpMyFolders.id, 1, { success: function (result) {
                    var nodes = eval(result);
                    tpMyFolders.initChildren(nodes)
                   // menMovetomyfolders.initItems()
                    //  menMovetomyfolders.initComponent()
                    menMovetomyfolders.doLayout()
                    menMovetomyfolders.layout.renderItem();
                }
        , eventMask: {
            showMask: true, msg: loadingMsg
        }
                });
            }
       
    
    
    }
  7. #7
    As I mentioned before you have to rerender widget (menu or button) using Render method
  8. #8
    Dear,
    It's still the same problem i can't get the data to the menu till i do refersh to all the page put i can update the tree when I click refresh button
    without refresh all the page i used the following functions:
    --------------------------
    btnMovetomyfolder.render();
    menMovetomyfolder.render();
    ------------------------------
    any other solution please

Similar Threads

  1. Toolbar Menu css style properties
    By garag in forum 1.x Help
    Replies: 1
    Last Post: Sep 30, 2011, 12:58 PM
  2. Access url from a Toolbar Menu
    By danilo in forum 1.x Help
    Replies: 3
    Last Post: Nov 10, 2010, 7:48 AM
  3. Menu + Toolbar
    By Dominik in forum 1.x Help
    Replies: 8
    Last Post: Apr 15, 2010, 4:35 AM
  4. toolbar: drop down menu
    By Kamal in forum 1.x Help
    Replies: 3
    Last Post: Dec 22, 2009, 5:13 AM
  5. Toolbar menu click problem?
    By dbassett74 in forum 1.x Help
    Replies: 1
    Last Post: Apr 19, 2009, 2:55 AM

Posting Permissions