Extjs5 Uncaught TypeError: Cannot read property 'metaData' of null

ぐ巨炮叔叔 提交于 2019-12-12 03:18:29

问题


Uncaught TypeError: Cannot read property 'metaData' of null

I moved from Ext4 to 5 and this error came while trying to load data ftom a treestore.Any Ideas?


回答1:


Ext.define(TreeSearchProxy, { extend: 'Ext.data.proxy.Ajax', alias: 'proxy.treesearchproxy', requires: [ TreeSearchResultsReader ], reader: 'treesearchreader', url : eaxies.util.Globals.ServletName, simpleSortMode : true, extraParams :{ ActionID: eaxies.util.Globals.ServletActions.RetrieveTreeSearchResults, query: null, dioikitikidiairesi: null, elementId: null, originalElementId: null, expandedNodeIds: null } });enter code here




回答2:


    Ext.define(TreeSearchResultsStore, {    
        extend: 'Ext.data.TreeStore',
        requires: [
            TreeSearchProxy
        ],
        model: TreeSearchResultsModel,
        autoLoad : false,   
        sorters: [{
            property: 'text',
            direction: 'ASC'
        }],
        proxy:'treesearchproxy'
    });
    Ext.define(TreeSearchResultsStore, {    
        extend: 'Ext.data.TreeStore',
        requires: [
            TreeSearchProxy
        ],
        model: TreeSearchResultsModel,
        autoLoad : false,   
        sorters: [{
            property: 'text',
            direction: 'ASC'
        }],
        proxy:'treesearchproxy'
    }); 


Ext.define(TreeSearchController, {
    extend: ControllerBase,
    models: [
        TreeSearchResultsModel
    ],
    stores: [
        TreeSearchResultsStore
    ],
    views: [
        TreeSearchPanel,
        DioikitikiDiairesiPanel
    ],
    init: function() {  
        this.control({
            'clickableimage[itemId=btnTreeSearch]': {
                click: this.onTreeSearchButtonClick
            },
            'textfield[itemId=txtTreeSearchQuery]': {
                specialkey: this.onTreeSearchQueryTextBoxSpecialKey
            },
            'treepanel[itemId=pnlTreeSearchResults]': {
            //  itemclick: this.onTreeSearchResultsPanelItemClick,
                afterrender: this.afterTreePanelRender,
                selectionchange: this.onTreeSearchResultsPanelSelectionChange
            },
            'dioikitikidiairesipanel[itemId=pnlDioikitikiDiairesi]': {
                selectKapodistrias: this.onSelectKapodistrias,
                selectKallikratis: this.onSelectKallikratis
            },
            'clickablepanel[itemId=pnlTreeSearchHints]': {
                click: this.onTreeSearchHintsClick
            }
        });
    },
    getActiveSearchPanel: function(component) {
        var activeTab = this.getController(MainController).getActiveTabPanel(component);
        return activeTab ? activeTab.down('searchpanel') : null;
    },
    getActiveTreeSearchQueryTextBox: function(activeSearchPanel) {
        return activeSearchPanel ? activeSearchPanel.queryById('txtTreeSearchQuery') : null;
    },
    getActiveDioikitikesDiaireseisComboBox: function(activeSearchPanel) {
        return activeSearchPanel ? activeSearchPanel.queryById('cmdDioikitikesDiaireseis') : null;
    },
    getActiveTreeSearchPanel: function(activeSearchPanel) {
        return activeSearchPanel ? activeSearchPanel.down('treesearchpanel') : null;
    },
    getActiveTreeSearchResultsPanel: function(activeSearchPanel) {
        return activeSearchPanel ? activeSearchPanel.queryById('pnlTreeSearchResults') : null;
    },
    getActiveTreeSearchResultsLabel: function(activeSearchPanel) {
        return activeSearchPanel ? activeSearchPanel.queryById('lbResults') : null;
    },
    getActiveTreeSearchDurationLabel: function(activeSearchPanel) {
        return activeSearchPanel ? activeSearchPanel.queryById('lbDuration') : null;
    },
    getActiveTreeStore: function(activeSearchPanel) {
        var activeResultsPanel = this.getActiveTreeSearchResultsPanel(activeSearchPanel);
        return activeSearchPanel ? activeResultsPanel.getStore() : null;
    },
    onLaunch: function(application) {

    },
    afterTreePanelRender: function(treePanel, eOpts) {
        var treeStore = treePanel.getStore();
        treeStore.addListener('load', this.afterTreeStoreLoad, this);
        treeStore.getProxy().addListener('exception', this.onTreeStoreProxyError, this);
        treeStore.getProxy().getReader().addListener('responseReceived', this.onTreeStoreProxyResponseReceived, this);
        treeStore.getProxy().extraParams.elementId = treePanel.getId();
    },
    afterTreeStoreLoad: function(store, node, records, successfull, eOpts) {        
        var activePanel = this.getActiveSearchPanel();
        var resultsPanel = this.getActiveTreeSearchResultsPanel(activePanel);
        this.stopLoading(resultsPanel, 'Σφάλμα αναζήτησης', successfull, null);

        var treePanel = this.getActiveTreeSearchPanel(activePanel);
        treePanel.selectPredefinedRecord();
    },
    onTreeStoreProxyResponseReceived: function(proxy, jsonObject) {
        var activePanel = this.getActiveSearchPanel();
        this.getActiveTreeSearchResultsLabel(activePanel).setText(jsonObject.totalResults);

        if (jsonObject.durationMillis)
            this.getActiveTreeSearchDurationLabel(activePanel).setText('(' + jsonObject.durationMillis + ' ms)');

        if (jsonObject.resultBlockId)
        {
            if (jsonObject.currentNode && this.isNullOrEmpty(jsonObject.currentNode.parentId))
                this.selectUniqueBlock(activePanel, jsonObject.resultBlockId, jsonObject.currentNode);
        }
        else if (jsonObject.totalResults == 1)
        {
            if (jsonObject.currentNode && this.isNullOrEmpty(jsonObject.currentNode.parentId))
                this.selectUniqueResult(activePanel, jsonObject.currentNode, jsonObject.inputNumber, true);
        }
    },
    onTreeStoreProxyError: function(proxy, response, operation, eOpts) {
        var activePanel = this.getActiveSearchPanel();
        var resultsPanel = this.getActiveTreeSearchResultsPanel(activePanel);
        this.stopLoading(resultsPanel, 'Σφάλμα αναζήτησης', false, response);
    },
    onTreeSearchButtonClick: function(button) {
        var activePanel = this.getActiveSearchPanel(button);
        var query = this.getActiveTreeSearchQueryTextBox(activePanel).getValue();
        var dioikitikiDiairesi = this.getActiveDioikitikesDiaireseisComboBox(activePanel).getValue();
        this.treeSearch(activePanel, query, dioikitikiDiairesi);
    },
    onTreeSearchQueryTextBoxSpecialKey: function(textbox, event, eOpts) {
        if (event.getKey() == event.ENTER)
            this.onTreeSearchButtonClick(textbox);
    },
    /*onTreeSearchResultsPanelItemClick: function(panel, record, item, index, e, eOpts) {
        var activePanel = this.getActiveSearchPanel(panel);
        this.selectTreeItem(activePanel, record ? record.data : null);
    },*/
    onTreeSearchResultsPanelSelectionChange: function(selectionModel, records) {
        var activePanel = this.getActiveSearchPanel();
        var record = (records && records.length > 0) ? records[0] : null;
        this.selectTreeItem(activePanel, record ? record.data : null);
    },
    onSelectKapodistrias: function(sourcePanel) {
        this.toggleDioikitikiDiairesi(sourcePanel, eaxies.util.Globals.DioikitikesDiaireseis.Kapodistrias);
    },
    onSelectKallikratis: function(sourcePanel) {
        this.toggleDioikitikiDiairesi(sourcePanel, eaxies.util.Globals.DioikitikesDiaireseis.Kallikratis);
    },
    onTreeSearchHintsClick: function(sourcePanel) {
        var activeTreeSearchPanel = sourcePanel.up('treesearchpanel');
        activeTreeSearchPanel.showSearchHints();
    },
    toggleDioikitikiDiairesi: function(sourcePanel, dioikitikiDiairesi) {
        var activeSearchPanel = this.getActiveSearchPanel(sourcePanel);
        var query = this.getActiveTreeSearchQueryTextBox(activeSearchPanel).getValue();
        this.treeSearch(activeSearchPanel, query, dioikitikiDiairesi);
    },
    treeSearch: function(activePanel, query, dioikitikiDiairesi) {  
        if (this.isNullOrEmpty(query))
            return;

        if (!dioikitikiDiairesi)
            return;

        var activeResultsPanel = this.getActiveTreeSearchResultsPanel(activePanel);

        var store = activeResultsPanel.getStore();
        store.getProxy().extraParams.query = query;
        store.getProxy().extraParams.dioikitikidiairesi = dioikitikiDiairesi;       

        this.startLoading(activeResultsPanel, 'Αναζήτηση ...');
        store.load();
    },
    clear: function() {
        var activePanel = this.getActiveSearchPanel();
        if (!activePanel)
            return null;

        var resultsPanel = this.getActiveTreeSearchResultsPanel(activePanel);

        var store = resultsPanel.getStore();        
        store.getProxy().extraParams.query = null;
        store.getProxy().extraParams.dioikitikidiairesi = null;
        eaxies.util.Common.clearStore(store);

        this.getActiveTreeSearchQueryTextBox(activePanel).reset();
        this.getActiveTreeSearchResultsLabel(activePanel).setText('');
        this.getActiveTreeSearchDurationLabel(activePanel).setText('');

        return resultsPanel.getId();
    },
    selectTreeItem: function(activeSearchPanel, recordData) {
        if (!recordData)
            return;

        var recordType = recordData.nodeType;
        if (!recordType)
            return;

        var treeStore = this.getActiveTreeStore(activeSearchPanel);

        if (recordType == eaxies.util.Globals.TreeSearchNodeTypes.Nomos)
        {
            var entityRecord = this.createNomos(recordData);
            this.getController(AxiesMapController).selectNomos(activeSearchPanel, entityRecord);
            this.getController(GoogleMapController).selectNomos(activeSearchPanel, entityRecord);
        }

        if (recordType == eaxies.util.Globals.TreeSearchNodeTypes.DimosKapodistria)
        {
            var entityRecord = this.createDimosKapodistria(treeStore, recordData);
            this.getController(AxiesMapController).selectDimosKapodistria(activeSearchPanel, entityRecord);
            this.getController(GoogleMapController).selectDimosKapodistria(activeSearchPanel, entityRecord);
        }

        if (recordType == eaxies.util.Globals.TreeSearchNodeTypes.DimotikoDiamerisma)
        {
            var entityRecord = this.createDimotikoDiamerisma(treeStore, recordData);
            this.getController(AxiesMapController).selectDimotikoDiamerisma(activeSearchPanel, entityRecord);
            this.getController(GoogleMapController).selectDimotikoDiamerisma(activeSearchPanel, entityRecord);
        }

        if (recordType == eaxies.util.Globals.TreeSearchNodeTypes.OikismosKapodistria)
        {
            var entityRecord = this.createOikismosKapodistria(treeStore, recordData);
            this.getController(AxiesMapController).selectOikismosKapodistria(activeSearchPanel, entityRecord);
            this.getController(GoogleMapController).selectOikismosKapodistria(activeSearchPanel, entityRecord);
        }   

        if (recordType == eaxies.util.Globals.TreeSearchNodeTypes.PerifereiakiEnotita)
        {
            var entityRecord = this.createPerifereiakiEnotita(recordData);
            this.getController(AxiesMapController).selectPerifereiakiEnotita(activeSearchPanel, entityRecord);
            this.getController(GoogleMapController).selectPerifereiakiEnotita(activeSearchPanel, entityRecord);
        }

        if (recordType == eaxies.util.Globals.TreeSearchNodeTypes.DimosKallikrati)
        {
            var entityRecord = this.createDimosKallikrati(treeStore, recordData);
            this.getController(AxiesMapController).selectDimosKallikrati(activeSearchPanel, entityRecord);
            this.getController(GoogleMapController).selectDimosKallikrati(activeSearchPanel, entityRecord);
        }

        if (recordType == eaxies.util.Globals.TreeSearchNodeTypes.DimotikiEnotita)
        {
            var entityRecord = this.createDimotikiEnotita(treeStore, recordData);
            this.getController(AxiesMapController).selectDimotikiEnotita(activeSearchPanel, entityRecord);
            this.getController(GoogleMapController).selectDimotikiEnotita(activeSearchPanel, entityRecord);
        }

        if (recordType == eaxies.util.Globals.TreeSearchNodeTypes.Koinotita)
        {
            var entityRecord = this.createKoinotita(treeStore, recordData);
            this.getController(AxiesMapController).selectKoinotita(activeSearchPanel, entityRecord);
            this.getController(GoogleMapController).selectKoinotita(activeSearchPanel, entityRecord);
        }

        if (recordType == eaxies.util.Globals.TreeSearchNodeTypes.OikismosKallikrati)
        {
            var entityRecord = this.createOikismosKallikrati(treeStore, recordData);
            this.getController(AxiesMapController).selectOikismosKallikrati(activeSearchPanel, entityRecord);
            this.getController(GoogleMapController).selectOikismosKallikrati(activeSearchPanel, entityRecord);
        }

        if (recordType == eaxies.util.Globals.TreeSearchNodeTypes.Dromos)
        {
            var dromosRecordData = this.createDromos(recordData);           
            var dromosName = recordData.name;
            var dromosNumber = recordData.dromosNumber;
            var kathetosId = null;
            var dromosNumberNotFound = recordData.dromosNumberNotFound;
            this.getController(AxiesMapController).selectDromos(activeSearchPanel, dromosRecordData, dromosName, dromosNumber, kathetosId, dromosNumberNotFound);
            this.getController(GoogleMapController).selectDromos(activeSearchPanel, dromosRecordData, dromosName, dromosNumber, kathetosId, dromosNumberNotFound);
        }

        if (recordType == eaxies.util.Globals.TreeSearchNodeTypes.Kathetos)
        {
            var dromosRecordData = this.createDromos(this.findParentRecordData(treeStore, recordData));
            var dromosName = null;
            var dromosNumber = null;
            var kathetosId = recordData.systemId;
            this.getController(AxiesMapController).selectDromos(activeSearchPanel, dromosRecordData, dromosName, dromosNumber, kathetosId, false);
            this.getController(GoogleMapController).selectDromos(activeSearchPanel, dromosRecordData, dromosName, dromosNumber, kathetosId, false);
        }

        if (recordType == eaxies.util.Globals.TreeSearchNodeTypes.Block)
        {
            var blockRecordData = this.createBlock(recordData);
            this.getController(AxiesMapController).selectBlock(activeSearchPanel, blockRecordData);
            this.getController(GoogleMapController).selectBlock(activeSearchPanel, blockRecordData);
        }

        if (recordType == eaxies.util.Globals.TreeSearchNodeTypes.Mikto)
        {

        }

        if (recordType == eaxies.util.Globals.TreeSearchNodeTypes.AAGis)
        {

        }

        if (recordType == eaxies.util.Globals.TreeSearchNodeTypes.PointOfInterest)
        {

        }       

        this.getController(SearchController).setCalculationSystemsStatus(activeSearchPanel, recordData.hasAntikeimeniko, recordData.hasMikto, recordData.hasAAGis); 

        if (recordData.hasMikto && recordData.hasMikto == true)
            this.getController(MiktoController).requestRegionDetails(activeSearchPanel, recordData.regionId);

        if (recordData.hasAAGis && recordData.hasAAGis == true)
            this.getController(AAGisController).requestRegionDetails(activeSearchPanel, recordData.regionId);
    },
    selectUniqueBlock: function(activePanel, blockId, resultNode) {
        if (this.isNullOrEmpty(blockId))
            return;

        var dromosNode = this.findChild(resultNode, eaxies.util.Globals.TreeSearchNodeTypes.Dromos);
        var dromosId = dromosNode ? dromosNode.systemId : null;

        this.getController(AxiesMapController).selectBlockById(activePanel, blockId, true, true, dromosId);
        this.getController(GoogleMapController).selectBlockById(activePanel, blockId);
    },
    createTreeRecord: function(nodeData) {
        if (!nodeData)
            return null;

        var record = Ext.create(TreeSearchResultsModel, {            
            id: nodeData.serverId,
            parentId: nodeData.parentId,
            name: nodeData.name,
            description: nodeData.description,
            text: nodeData.text,
            leaf: nodeData.leaf,
            loaded: nodeData.loaded,
            expanded: nodeData.expanded,
            cls: nodeData.cls,
            iconCls: nodeData.iconCls,
            qtip: nodeData.qtip,
            entityId: nodeData.entityId,
            hasAntikeimeniko: nodeData.hasAntikeimeniko,
            hasMikto: nodeData.hasMikto,
            hasAAGis: nodeData.hasAAGis,
            mapId: nodeData.mapId,
            result: nodeData.result,
            systemId: nodeData.systemId,
            nodeType: nodeData.nodeType,
            centerBlockId: nodeData.centerBlockId,
            regionId: nodeData.regionId,
            mapNotes: nodeData.mapNotes,
            uniqueBlockId: nodeData.uniqueBlockId,
            isMonozonikos: nodeData.isMonozonikos,
            hasNumbering: nodeData.hasNumbering,
            mapX: nodeData.mapX,
            mapY: nodeData.mapY
        });

        return record;
    },
    selectUniqueResult: function(activePanel, resultNode, dromosNumber, dromosNumberNotFound) {
        if (!resultNode)
            return;

        var treePanel = this.getActiveTreeSearchResultsPanel(activePanel);
        var treeStore = this.getActiveTreeStore(activePanel);

        var dromosNode = this.findChild(resultNode, eaxies.util.Globals.TreeSearchNodeTypes.Dromos);
        if (dromosNode)
        {
            var dromosRecord = this.createTreeRecord(dromosNode);
            dromosRecord.set('dromosNumber', dromosNumber);
            dromosRecord.set('dromosNumberNotFound', dromosNumberNotFound);
            treePanel.getSelectionModel().select(dromosRecord);
            return;
        }

        var blockNode = this.findChild(resultNode, eaxies.util.Globals.TreeSearchNodeTypes.Block);
        if (blockNode)
        {
            treePanel.getSelectionModel().select(this.createTreeRecord(blockNode));
            return;
        }

        var oikismosKallikratiNode = this.findChild(resultNode, eaxies.util.Globals.TreeSearchNodeTypes.OikismosKallikrati);
        if (oikismosKallikratiNode)
        {
            treePanel.getSelectionModel().select(this.createTreeRecord(oikismosKallikratiNode));
            return;
        }

        var oikismosKapodistriaNode = this.findChild(resultNode, eaxies.util.Globals.TreeSearchNodeTypes.OikismosKapodistria);
        if (oikismosKapodistriaNode)
        {
            treePanel.getSelectionModel().select(this.createTreeRecord(oikismosKapodistriaNode));
            return;
        }
    },
    findChild: function(node, nodeType) {
        if ((!node) || (!nodeType))
            return null;

        if (node.nodeType && node.nodeType == nodeType)
            return node;

        if (node.children && node.children.length > 0)
        {
            for (var i = 0; i < node.children.length; i++)              
            {
                var result = this.findChild(node.children[i], nodeType);
                if (result)
                    return result;              
            }
        }

        return null;
    },
    createDioikitikiDiairesi: function(treeRecordData) {
        if (!treeRecordData)
            return null;

        return {
            serverId: treeRecordData.systemId,
            name: treeRecordData.name,
            description: treeRecordData.description,
            text: treeRecordData.text,
            hasAntikeimeniko: treeRecordData.hasAntikeimeniko,
            hasMikto: treeRecordData.hasMikto,
            hasAAGis: treeRecordData.hasAAGis,
            mapId: treeRecordData.mapId,
            centerBlockId: treeRecordData.centerBlockId,
            mapNotes: treeRecordData.mapNotes,
            uniqueBlockId: treeRecordData.uniqueBlockId,
            isMonozonikos: treeRecordData.isMonozonikos,
            hasNumbering: treeRecordData.hasNumbering,
            mapX: treeRecordData.mapX,
            mapY: treeRecordData.mapY
        };
    },
    findParentRecordData: function(treeStore, treeRecordData) {
        if ((!treeStore) || (!treeRecordData))
            return null;

        var parentId = treeRecordData.parentId;
        if (!parentId)
            return null;

        var parentRecord = eaxies.util.Common.retrieveTreeStoreNode(treeStore, parentId);       
        return parentRecord ? parentRecord.data : null;
    },
    createPerifereiakiEnotita: function(treeRecordData) {
        var record = this.createDioikitikiDiairesi(treeRecordData);
        if (!record)
            return null;

        return record;
    },
    createDimosKallikrati: function(treeStore, treeRecordData) {
        var record = this.createDioikitikiDiairesi(treeRecordData);
        if (!record)
            return null;    

        var perifereiakiEnotitaRecordData = this.findParentRecordData(treeStore, treeRecordData);       
        record.perifereiakiEnotitaId = perifereiakiEnotitaRecordData ? perifereiakiEnotitaRecordData.systemId : null;
        record.perifereiakiEnotitaName = perifereiakiEnotitaRecordData ? perifereiakiEnotitaRecordData.name : null;

        return record;
    },
    createDimotikiEnotita: function(treeStore, treeRecordData) {
        var record = this.createDioikitikiDiairesi(treeRecordData);
        if (!record)
            return null;

        var dimosRecordData = this.findParentRecordData(treeStore, treeRecordData);
        record.dimosId = dimosRecordData ? dimosRecordData.systemId : null;
        record.dimosName = dimosRecordData ? dimosRecordData.name : null;

        var perifereiakiEnotitaRecordData = this.findParentRecordData(treeStore, dimosRecordData);
        record.perifereiakiEnotitaId = perifereiakiEnotitaRecordData ? perifereiakiEnotitaRecordData.systemId : null;
        record.perifereiakiEnotitaName = perifereiakiEnotitaRecordData ? perifereiakiEnotitaRecordData.name : null;

        return record;
    },
    createKoinotita: function(treeStore, treeRecordData) {
        var record = this.createDioikitikiDiairesi(treeRecordData);
        if (!record)
            return null;

        var dimotikiEnotitaRecordData = this.findParentRecordData(treeStore, treeRecordData);
        record.dimotikiEnotitaId = dimotikiEnotitaRecordData ? dimotikiEnotitaRecordData.systemId : null;
        record.dimotikiEnotitaName = dimotikiEnotitaRecordData ? dimotikiEnotitaRecordData.name : null;

        var dimosRecordData = this.findParentRecordData(treeStore, dimotikiEnotitaRecordData);
        record.dimosId = dimosRecordData ? dimosRecordData.systemId : null;
        record.dimosName = dimosRecordData ? dimosRecordData.name : null;

        var perifereiakiEnotitaRecordData = this.findParentRecordData(treeStore, dimosRecordData);
        record.perifereiakiEnotitaId = perifereiakiEnotitaRecordData ? perifereiakiEnotitaRecordData.systemId : null;
        record.perifereiakiEnotitaName = perifereiakiEnotitaRecordData ? perifereiakiEnotitaRecordData.name : null;

        return record;
    },
    createOikismosKallikrati: function(treeStore, treeRecordData) {
        var record = this.createDioikitikiDiairesi(treeRecordData);
        if (!record)
            return null;

        var koinotitaRecordData = this.findParentRecordData(treeStore, treeRecordData);
        record.koinotitaId = koinotitaRecordData ? koinotitaRecordData.systemId : null;
        record.koinotitaName = koinotitaRecordData ? koinotitaRecordData.name : null;

        var dimotikiEnotitaRecordData = this.findParentRecordData(treeStore, koinotitaRecordData);
        record.dimotikiEnotitaId = dimotikiEnotitaRecordData ? dimotikiEnotitaRecordData.systemId : null;
        record.dimotikiEnotitaName = dimotikiEnotitaRecordData ? dimotikiEnotitaRecordData.name : null;

        var dimosRecordData = this.findParentRecordData(treeStore, dimotikiEnotitaRecordData);
        record.dimosId = dimosRecordData ? dimosRecordData.systemId : null;
        record.dimosName = dimosRecordData ? dimosRecordData.name : null;

        var perifereiakiEnotitaRecordData = this.findParentRecordData(treeStore, dimosRecordData);
        record.perifereiakiEnotitaId = perifereiakiEnotitaRecordData ? perifereiakiEnotitaRecordData.systemId : null;
        record.perifereiakiEnotitaName = perifereiakiEnotitaRecordData ? perifereiakiEnotitaRecordData.name : null;

        return record;
    },  
    createNomos: function(treeRecordData) {
        var record = this.createDioikitikiDiairesi(treeRecordData);
        if (!record)
            return null;            

        return record;
    },
    createDimosKapodistria: function(treeStore, treeRecordData) {
        var record = this.createDioikitikiDiairesi(treeRecordData);
        if (!record)
            return null;

        var nomosRecordData = this.findParentRecordData(treeStore, treeRecordData);
        record.nomosId = nomosRecordData ? nomosRecordData.systemId : null;
        record.nomosName = nomosRecordData ? nomosRecordData.name : null;

        return record;
    },
    createDimotikoDiamerisma: function(treeStore, treeRecordData) {
        var record = this.createDioikitikiDiairesi(treeRecordData);
        if (!record)
            return null;

        var dimosRecordData = this.findParentRecordData(treeStore, treeRecordData);
        record.dimosId = dimosRecordData ? dimosRecordData.systemId : null;
        record.dimosName = dimosRecordData ? dimosRecordData.name : null;

        var nomosRecordData = this.findParentRecordData(treeStore, dimosRecordData);
        record.nomosId = nomosRecordData ? nomosRecordData.systemId : null;
        record.nomosName = nomosRecordData ? nomosRecordData.name : null;

        return record;
    },
    createOikismosKapodistria: function(treeStore, treeRecordData) {
        var record = this.createDioikitikiDiairesi(treeRecordData);
        if (!record)
            return null;

        var dimotikoDiamerismaRecordData = this.findParentRecordData(treeStore, treeRecordData);
        record.dimotikoDiamerismaId = dimotikoDiamerismaRecordData ? dimotikoDiamerismaRecordData.systemId : null;
        record.dimotikoDiamerismaName = dimotikoDiamerismaRecordData ? dimotikoDiamerismaRecordData.name : null;

        var dimosRecordData = this.findParentRecordData(treeStore, dimotikoDiamerismaRecordData);
        record.dimosId = dimosRecordData ? dimosRecordData.systemId : null;
        record.dimosName = dimosRecordData ? dimosRecordData.name : null;

        var nomosRecordData = this.findParentRecordData(treeStore, dimosRecordData);
        record.nomosId = nomosRecordData ? nomosRecordData.systemId : null;
        record.nomosName = nomosRecordData ? nomosRecordData.name : null;

        return record;
    },
    createDromos: function(treeRecordData) {
        if (!treeRecordData)
            return null;

        return {        
            serverId: treeRecordData.serverId,
            name: treeRecordData.name,
            mapServerId: treeRecordData.systemId,
            isBlock: false,
            mapX: treeRecordData.mapX,
            mapY: treeRecordData.mapY
        };
    },
    createBlock: function(treeRecordData) {
        if (!treeRecordData)
            return null;

        return {        
            serverId: treeRecordData.serverId,
            name: treeRecordData.name,
            mapServerId: treeRecordData.systemId,
            isBlock: true,
            mapX: treeRecordData.mapX,
            mapY: treeRecordData.mapY
        };
    },
    addExpandedNodeIds: function(node, expandedNodeIds) {
        if ((!node) || (!expandedNodeIds))
            return;

        if (node.data.expanded == true)
            expandedNodeIds.push(node.data.id);

        if ((!node.childNodes) || (node.childNodes.length == 0))
            return;

        for (var i = 0; i < node.childNodes.length; i++)
            this.addExpandedNodeIds(node.childNodes[i], expandedNodeIds);
    },
    getExpandedNodeIds: function(node) {
        if (!node)
            return null;

        var expandedNodeIds = [];       

        this.addExpandedNodeIds(node, expandedNodeIds);

        if (expandedNodeIds.length == 0)
            return null;

        return {
            nodeIds: expandedNodeIds
        };
    },
    copyTreeSearchPanel: function(sourcePanel, targetPanel) {
        if ((!sourcePanel) || (!targetPanel))
            return;

        var sourceTreePanel = sourcePanel.down('treepanel');
        var sourceStore = sourceTreePanel.getStore();
        var sourceProxy = sourceStore.getProxy();

        var targetTreePanel = targetPanel.down('treepanel');
        var targetStore = targetTreePanel.getStore();
        var targetProxy = targetStore.getProxy();

        eaxies.util.Common.clearStore(targetStore);     
        targetProxy.extraParams.elementId = targetTreePanel.getId();
        targetProxy.extraParams.originalElementId = sourceTreePanel.getId();
        targetProxy.extraParams.query = sourceProxy.extraParams.query;
        targetProxy.extraParams.dioikitikidiairesi = sourceProxy.extraParams.dioikitikidiairesi;
        targetProxy.extraParams.expandedNodeIds = Ext.JSON.encode(this.getExpandedNodeIds(sourceStore.getRootNode()));
        targetStore.load();

        targetPanel.setPredefinedRecordId(sourcePanel.getSelectedRecordId());
        targetPanel.queryById('txtTreeSearchQuery').setValue(sourcePanel.queryById('txtTreeSearchQuery').getValue());
    },
    getSelectedOikismosData: function(sourcePanel) {
        var treePanel = this.getActiveTreeSearchPanel(sourcePanel);
        if (!treePanel)
            return null;

        var treeStore = this.getActiveTreeStore(treePanel);

        var selectedNodeData = treePanel.getSelectedNodeData();
        if ((!selectedNodeData) || (!selectedNodeData.nodeType))
            return null;

        if (selectedNodeData.nodeType == eaxies.util.Globals.TreeSearchNodeTypes.OikismosKallikrati)
            return this.createOikismosKallikrati(treeStore, selectedNodeData);

        if (selectedNodeData.nodeType == eaxies.util.Globals.TreeSearchNodeTypes.OikismosKapodistria)
            return this.createOikismosKapodistria(treeStore, selectedNodeData);

        return null;
    }
});



回答3:


Just in case.

I got this message too. In my case was a malformed json.



来源:https://stackoverflow.com/questions/27357686/extjs5-uncaught-typeerror-cannot-read-property-metadata-of-null

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!