1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    2
    Vote Rating
    0
    arjunc77 is on a distinguished road

      0  

    Default Unanswered: how to render a single record data from a store to a container.

    Unanswered: how to render a single record data from a store to a container.


    I have a tabpanel with the first tab displaying a user info.

    Code:
    Ext.define('MyApp.view.UserInfo', {
    extend: 'Ext.Container',
    alias: 'widget.User-Info',
    
    requires: [MyStore],
    
    
    config: {
    //items: {},
    xtype: 'User-Info'
    store: 'MyStore',
    fullscreen: true,
    tpl: Ext.create('Ext.XTemplate','{last_name}, and {id} {first_name}'),
    data: {
    //'first_name': 'abc', 'last_name': 'def'
    },
    
    listeners: { 
    painted: {
    fn: function(c, opts) {
    var ls = Ext.getStore('MyStore');
    // tried to get the record this way .....
    /*ls.filter(
    {
    property: 'id',
    value: mystoreid, //i am setting this value from a variable
    exactMatch: true
    }
    );*/
    //alternatively i tried the following way ....
    ls.load(mystoreid, {
    success: function(user) {
    console.log(user.getId()); 
    }
    });
    }//fn
    }//painted
    }//listeners
    });

    I am not able to get the filtered user from the store. I want him to be rendered in the template. and displayed by the container.

    What should i set the xtype as ?
    I could easily get the store to be displayed as a list. But in this case i need a single record.

    And also what is the best way to load a store in the initialization of the component?
    I tried several ways, Please help.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,714
    Vote Rating
    438
    Answers
    3113
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Is this ST2 or Ext JS 4?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    May 2012
    Posts
    2
    Vote Rating
    0
    arjunc77 is on a distinguished road

      0  

    Default


    sorry my mistake.

Tags for this Thread