[CLOSED] getXtypes From DOM

  1. #1

    [CLOSED] getXtypes From DOM

    Hi all,

    Just got a quick question. I'm trying to create some generic validation for my site when a user changes tab. I'm using the TabBeforeChange event to check if the stores on that tab aren't dirty and therefore haven't got any data pending to be saved to the DB, I do this by

        checkTabStoreManagerForChanges: function (tab) {
            if (lastDirtyTab == tab) {
                return true;
            }
            if (typeof (tab) != "undefined") {
                if (typeof (tab.iframe) != "undefined") {
                    if (typeof (tab.iframe.dom.contentWindow.Ext) != "undefined") {
                        if (typeof (tab.iframe.dom.contentWindow.Ext.StoreMgr.items) != "undefined") {
                            var stores = tab.iframe.dom.contentWindow.Ext.StoreMgr.items;
                            for (var i = 0; i < stores.length; i++) {
                                if (stores[i].getModifiedRecords().length > 0)
                                    if (stores[i].proxyId != "powerOfAttorneyStore") {
                                        return false;
                                    }
                            }
                            //SaveAndInvest.warningBox('Number', "There are " + stores.length + " stores on this Frame");
                            return true;
                        }
                        return true;
                    }
                    return true;
                }
                return true;
            }
            return true;
        },
    What I'm now trying to doing do now is check if there are any ext:formpanels on page which have new content in them and if there is return false. I won't know what the Id's are because this is being used across the site which has alot of forms. My I idea is if I can check the xtypes of the dom elements and if its a "form" I would check if its dirty but I don't know how I would get the xtypes of all the elements of the DOM which are "forms". Any idea would be great
    Last edited by Daniil; Jul 03, 2012 at 3:11 PM. Reason: [CLOSED]
  2. #2
    Hi,

    I would use the ComponentMgr.
    http://docs.sencha.com/ext-js/3-4/#!/api/Ext.ComponentMgr

    Example
    Ext.ComponentMgr.all.each(function (c) {
        if (c instanceof Ext.form.FormPanel) {
            //the "c" is a FormPanel instance here
        }
    });
  3. #3
    Daniil thanks for the help it worked a treat

Tags for this Thread

Posting Permissions