Results 1 to 3 of 3

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

  1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    2
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3932
    Vote Rating
    1272
      0  

    Default

    Is this ST2 or Ext JS 4?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

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

  3. #3
    Sencha User
    Join Date
    May 2012
    Posts
    2
    Vote Rating
    0
      0  

    Default

    sorry my mistake.

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
  •