How to retreive component ID ?

  1. #1

    How to retreive component ?

    Hello,

    How to find component from other page ?

    I used this script :
    Ext.getCmp('componentID')
    I had this result on console :
    undefined
    Last edited by wadhah; Nov 08, 2011 at 2:27 PM.
  2. #2

    [Solved] How to retreive component ID

    You should implement this script on the page that contains the component in this case I will use a TabPanel
     <script type="text/javascript">
    // this function get the TabPanel component
            var returnTheTab = function () {
                return Ext.getCmp('tpMain');
            }
        </script>
    <ext:TabPanel ID="tpMain" runat="server" Region="Center" Margins="0 0 4 0" EnableTabScroll="true"
                    IDMode="Static">
    // .....
    
       </ext:TabPanel>
    And this script on the page that you want retrieve the component 'TabPanel"

     <script type="text/javascript">
    
            var commandHandler = function (cmd) {
                if (cmd == "view") {
                    var rootWindow = getRootWindow();
                    var tab = rootWindow.returnTheTab();
                  alert(tab);
                }
            };
    
    // Get the parent Window
            function getRootWindow() {
                try {
                    var wnd = this;
                    while (wnd.parent.frameElement != null) {
                        wnd = wnd.parent;
                    }
                    return wnd.parent;
                }
                catch (e) {
                }
            }
    
        </script>

Similar Threads

  1. Ext.Net and Calendar component
    By r_honey in forum Open Discussions
    Replies: 3
    Last Post: Dec 10, 2010, 8:28 PM
  2. Add Ext JavaScript Component to Component
    By geoffrey.mcgill in forum Examples and Extras
    Replies: 3
    Last Post: Mar 10, 2010, 12:38 PM
  3. Add asp component on ext:Panel
    By diegopaulin in forum 1.x Help
    Replies: 0
    Last Post: Feb 18, 2010, 8:10 AM
  4. Replies: 1
    Last Post: May 22, 2009, 7:38 AM

Posting Permissions