1. #1
    Sencha Premium Member
    Join Date
    Oct 2012
    Location
    Antibes
    Posts
    66
    Answers
    4
    Vote Rating
    0
    Gaspard22 is on a distinguished road

      0  

    Default Answered: loading a store from the controller ?

    Answered: loading a store from the controller ?


    Hello, i'm trying to reload a list , with my fresh records , but i don't succeed in doing this , someone could help me ?

    i'm retrieve firstly my data from a Json proxy with associations, and i need to get this data in a list already created

    here's the function called in my controller

    Code:
    refs:
            {
                main: 'navMainPanel',
                fichePat :'fichePat1',
                listPrest :'listePresta',
                ajoutact :'AjoutActePanel',
                histoActes:'histoTraitement',
                test:'AgendaPanel'
            },
    
    var imgs = this.getTest();
           imgs.setStore(record.get('docs'));
           console.log(imgs);
    my List
    Code:
     Ext.define('CWFSE.view.Agenda', {
        extend:'Ext.List',
        
        xtype:'AgendaPanel',
         requires: [
            'CWFSE.store.ImagerieStore'
        ],
        config:{
           
             title : 'Liste Images',
                        
                    itemTpl: Ext.create('Ext.XTemplate',
                    '<table style="width:100%">',
                    '<tr><td style="width:50%"><img src={UPL_PATH} /></td>',
                    '<td style="width:50%">{UPL_NAME}</td>',
                    '</tr></table>'
            ),
                        store:{ xclass : 'CWFSE.store.ImagerieStore'}
        },
             listeners: {
                            itemtap: {
                                fn: function(view, index, item, e){
                                    var rec = view.getStore().getAt(index);
                                    console.log(rec);
                                    var mysheet = new Ext.Sheet(
                                        
                                {
                                    height:400,
                                    layout:'vbox',
                                    stretchX:true,
                                    items:[
                                        {
                                            xtype:'container',
                                            layout:'fit',
                                            flex:1,
                                            padding :10,
                                            style:'color:#FFFFFF',
                                            html: [
                                                    '<img src='+rec.get('UPL_PATH')+' width=50%/>'
                        ].join("")
                                            
                                        },
                                        {
                                            xtype:'button',
                                            text:'fermer',
                                            height:30,
                                            width :100,
                                            handler:function(){
                                                this.up('sheet').hide();
                                            }
                                        }
                                    ],
                                    listeners:{
                                        hide:{
                                            fn:function(){
                                                this.destroy();
                                            }
                                        }
                                    }
                                }
                            )
                            mysheet.show();
                        
                                }
                                
                            }
                }
        
        });

  2. Quote Originally Posted by Gaspard22 View Post
    i found maybe the problem,

    my record.get('docs') is an array of records. But i then i tried to use setData(), but it's not working although....

    HELP PLEASE
    well that 's was part of the problem, but i have forgotten the store.load ,

  3. #2
    Sencha Premium Member
    Join Date
    Oct 2012
    Location
    Antibes
    Posts
    66
    Answers
    4
    Vote Rating
    0
    Gaspard22 is on a distinguished road

      0  

    Default


    i found maybe the problem,

    my record.get('docs') is an array of records. But i then i tried to use setData(), but it's not working although....

    HELP PLEASE

  4. #3
    Sencha Premium Member
    Join Date
    Oct 2012
    Location
    Antibes
    Posts
    66
    Answers
    4
    Vote Rating
    0
    Gaspard22 is on a distinguished road

      0  

    Default


    Quote Originally Posted by Gaspard22 View Post
    i found maybe the problem,

    my record.get('docs') is an array of records. But i then i tried to use setData(), but it's not working although....

    HELP PLEASE
    well that 's was part of the problem, but i have forgotten the store.load ,