Results 1 to 8 of 8

Thread: Why isn't the component view populating with store data?

  1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    125
    Answers
    1
    Vote Rating
    0
      0  

    Default Unanswered: Why isn't the component view populating with store data?

    I can not seem to figure out the reason why the component view is not populating with the store data in the below scenario. Hopefully, someone here can help me out because I am at a lost for words.

    * No errors or warnings are present.

    Thanks

    app.js
    Code:
    /*
    * Editorial model
    */
    Ext.define('sms.models.editorial.Editorial',{
        extend: 'Ext.data.Model',
        
            idProperty: 'id',
            fields: [
                {name: 'id' , type: 'int'},
                {name: 'title' , type: 'string'}
            ]
        
    });
    
    /*
    * Editorial headlines store
    */
    Ext.define('sms.stores.editorial.EditorialHeadlines',{
        extend: 'Ext.data.Store',
        
            autoLoad: true,
            pageSize: 20,
            model: 'sms.models.editorial.Editorial',
            proxy: {
                type: 'ajax',
                url: 'data.xml',
                reader: {
                    type: 'xml',
                    record: 'editorial'
                }
            }
        
    });
    
    /*
    * Editorial headlines view
    */
    Ext.define('sms.views.editorial.Headlines',{
        extend: 'Ext.dataview.ComponentView',
        xtype: 'editorialheadlines',
        
        config: {
            defaultType: 'editoriallistitem',
            store: 'sms.stores.editorial.EditorialHeadlines'
        }
        
    });
    
    /*
    * Editorial list item view
    */
    Ext.define('sms.views.editorial.EditorialListItem',{
        extend: 'Ext.dataview.DataItem',
        xtype: 'editoriallistitem',
        config: {
            dataMap: {
                getTitle: {
                    setHTML: 'title'
                }
            },
            title: {
                cls: 'title'
            }
        },
        applyTitle: function(config) {
            return Ext.factory(config,Ext.Component,this.getTitle());
        },
        updateTitle: function(newTitle) {
            if(newTitle) {
                this.insert(0,newTitle);
            }
        }
    });
    
    Ext.application({
        name: 'sms',
        launch: function() {
        
            Ext.create('sms.views.editorial.Headlines',{fullscreen: true});
            
        }
    });
    data.xml
    Code:
    <?xml version="1.0"?>
    <editorials>
        <editorial>
            <id>1</id>
            <title>Editorial 1</title>
        </editorial>
        <editorial>
            <id>2</id>
            <title>Editorial 2</title>
        </editorial>
        <editorial>
            <id>3</id>
            <title>Editorial 3</title>
        </editorial>
    </editorials>

  2. #2
    Sencha User
    Join Date
    Sep 2011
    Posts
    125
    Answers
    1
    Vote Rating
    0
      0  

    Default

    hmmm removed defining the component view and instead instantiating it directly seems to load the items. However, the title is undefined.

    Code:
    Ext.application({
        name: 'sms',
        launch: function() {
        
            // Ext.create('sms.views.editorial.Headlines',{fullscreen: true});
            
            /*
            * Editorial headlines view
            */
            var list = Ext.create('Ext.dataview.ComponentView',{
                fullscreen: true,
                xtype: 'editorialheadlines',
                defaultType: 'editoriallistitem',
                store: Ext.create('sms.stores.editorial.EditorialHeadlines')
            });
            
        }
    });

  3. #3
    Sencha User
    Join Date
    Sep 2011
    Posts
    125
    Answers
    1
    Vote Rating
    0
      0  

    Default

    Anyone have an idea what is going on here or what I am doing incorrectly?

  4. #4
    Touch Premium Member
    Join Date
    Sep 2009
    Posts
    27
    Vote Rating
    2
      0  

    Default same problem

    there are some problema, I think, with the Ext.define

    when I instantiate the classes it works but if I try to define and then use it later, nothing happen...

  5. #5
    Sencha User
    Join Date
    Sep 2011
    Posts
    125
    Answers
    1
    Vote Rating
    0
      0  

    Default

    Any help here? I mean is it something that has been done incorrectly or a bug.

  6. #6
    Sencha User
    Join Date
    Sep 2011
    Posts
    125
    Answers
    1
    Vote Rating
    0
      0  

    Default

    ?

  7. #7
    Sencha User
    Join Date
    Sep 2011
    Posts
    46
    Answers
    1
    Vote Rating
    0
      0  

    Default

    Small thing I noticed, shouldn't setHTML be setHtml?

  8. #8
    Sencha User
    Join Date
    Jan 2012
    Posts
    7
    Vote Rating
    0
      0  

    Default try this

    try this way


    Ext.define('sms.stores.editorial.EditorialHeadlines',{ extend: 'Ext.data.Store', autoLoad: true, pageSize: 20, model: 'sms.models.editorial.Editorial', proxy: { type: 'ajax', url: 'data.xml', reader: { type: 'xml',// INSERT THIS root: 'editorials',// END INSERT THIS record: 'editorial' } } });

Posting Permissions

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