Results 1 to 4 of 4

Thread: Extjs 5 strange behavior of the getStore() method

  1. #1
    Sencha Premium User
    Join Date
    Mar 2015
    Posts
    40

    Default Extjs 5 strange behavior of the getStore() method

    I've faced with the strange getStore() method behavior.


    Having main viewport with two regions: north and center. On the north region there is a button 'Show grid', if to click on this button QueryResultsGridView is loaded to the center region


    Code:
    var panelToAddName = Ext.create('MyApp.view.QueryResultsGridView', {});
        var mainViewPort = Ext.getCmp('mainViewPort');
        var centerRegion = mainViewPort.down('[region=center]');
        centerRegion.removeAll();
        centerRegion.add(panelToAddName);

    my Store


    Code:
    Ext.define('MyApp.store.QueryResultsGridStore', {
            extend: 'Ext.data.Store',
            model: 'MyApp.model.QueryResultsGridModel',
            alias: 'store.queryResultsGrid',
            autoLoad: true,
            proxy: {
                type: 'ajax',
                url: 'queryResultsGrid.json',
                reader: {
                    type: 'json'
                }
            }
        });

    my ViewModel


    Code:
    Ext.define('MyApp.viewmodel.MainViewModel', {
            extend: 'Ext.app.ViewModel',
            
            requires: [
                'MyApp.store.QueryResultsGridStore'
            ],
            
            alias: 'viewmodel.main',
            
            stores: {
                queryResultsGrid: {
                    type: 'queryResultsGrid'
                }
        });

    my Panel


    Code:
    Ext.define('MyApp.view.QueryResultsGridView', {
            extend: 'Ext.Panel',
            requires: [
                'MyApp.controller.QueryResultsGridViewController'
            ],
            controller: 'queryResultsGrid',
            listeners: {
                afterrender: 'onFormAfterRender'
            },
            items:[{
                reference: 'queryResultsGrid',
                layout: 'fit',
                items: [
                {
                    xtype: 'grid',
                    reference: 'grid',
                    bind: {
                        store: '{queryResultsGrid}'
                    },
                    columns: [
                        { text: 'Text1', dataIndex: 'text1', flex: 1 },
                        { text: 'Text2', dataIndex: 'text2', flex: 3 }
                    ]
                }]
            }]
        });

    my ViewController


    Code:
    Ext.define('MyApp.controller.QueryResultsGridViewController', {
            extend: 'Ext.app.ViewController',
            
            alias: 'controller.queryResultsGrid',
            
            onFormAfterRender: function(form, parent1) {
                console.log(form.down('grid'));
                console.log(form.down('grid').store);
            }
        });
    Now in console I see 2 Objects as suggested above. If I go inside the first Object there is a data inside it, but inside the second one store is empty. Could anyone suggest me why? Btw I need this store to run store.load().


    first Object
    Screen Shot 2015-03-27 at 3.55.08 PM.png

    second Object
    Screen Shot 2015-03-27 at 3.55.22 PM.png

    I've posted the same question here http://stackoverflow.com/questions/2...etstore-method but still nobody.

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    In which specific version of Ext JS 5 are you seeing this?

  3. #3
    Sencha Premium User
    Join Date
    Mar 2015
    Posts
    40

    Default

    Quote Originally Posted by Gary Schlosberg View Post
    In which specific version of Ext JS 5 are you seeing this?
    it is 5.1.0.107 version

  4. #4
    Sencha Premium User
    Join Date
    Mar 2015
    Posts
    40

    Default

    anyone? Is it necessary to raise a bug in such situation?

    Here is https://fiddle.sencha.com/fiddle/kf3/preview if it helps, you can see in the console 2 Objects I mentioned above. Source code is available here https://fiddle.sencha.com/#fiddle/kf3

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •