View Full Version : how to render a single record data from a store to a container.

6 Jun 2012, 6:17 AM
I have a tabpanel with the first tab displaying a user info.

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 .....
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) {

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.

11 Jun 2012, 6:43 AM
Is this ST2 or Ext JS 4?

11 Jun 2012, 7:48 AM
sorry my mistake.