1. #1
    Sencha User
    Join Date
    Apr 2012
    Location
    Vicenza, Italy
    Posts
    26
    Answers
    3
    Vote Rating
    3
    acasaccia is on a distinguished road

      0  

    Default Unanswered: How to display a single page of dynamic data

    Unanswered: How to display a single page of dynamic data


    Hi everybody, from the sencha documentation I see that the folllowing are the components which can be bound to a store:

    Store-bound components
    What if I have to show a single component with data taken from a single element in a store? I tried instantiating a component and using tpl and data but with no success so far. data config is supposed to be retrieved dynamically from the first element of the store, but the function is never executed. This is the code:

    Code:
    Ext.define('MyApp.view.Featured', {
        extend: 'Ext.Container',
        config: {
            layout: 'fit',
            items: [
                {
                    xclass: 'Ext.TitleBar',
                    docked: 'top',
                    title: 'Featured'
                },
                {
                    xclass: 'Ext.Component',
                    styleHtmlContent: true,
                    tpl: ['<h5>{creazione}</h5>' +
    '<h3>{titolo}</h3>' +
    '<p>{abstract}</p>'].join(''),
                    data: function() {
                        console.log('here'); // these are never executed
                        debugger;
                        var data = {};
                        Ext.getStore('Featured').load({
                            scope: this,
                            callback: function(records, operation, success) {
                                if (success) {
                                    data = Ext.getStore('Featured').first().getData();
                                }
                            }
                        });
                        return data;
                    }
                }
            ]
        }
    });
    If I use a list with only one element and bind it to the "Featured" store, all works correctly, but I don't see why I should instantiate a list component when I want to display a single one.

    Thanks in advance for your answers.

  2. #2
    Sencha User
    Join Date
    Mar 2012
    Location
    The Netherlands
    Posts
    75
    Answers
    13
    Vote Rating
    4
    SebasSP is on a distinguished road

      0  

    Default


    This has confused me for a while as well. Now I get a reference to the view in the controller and also retreive my data there. I then call
    Code:
    this.getMyView().setData({ /*data object here*/ })
    This works, but I'd still like to know the best practice for dynamically displaying a single data item.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Location
    Vicenza, Italy
    Posts
    26
    Answers
    3
    Vote Rating
    3
    acasaccia is on a distinguished road

      1  

    Default


    Thank you SebasSP for sharing your experience. I ended up using a DataView instead of a Component. It renders itself nicely and I can use a Store transparently like I would have done with a List.
    Still, a thought on this topic from one of the framework developers would be welcome

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi