PDA

View Full Version : Linking one Xtemplate to another



Pat Emi
8 Oct 2012, 1:14 AM
Hi,please is it possible to link one xtemplate to another?I'm currently working on an app, where the first xtemplate posts a comment ,and others are to comment on the post.Am i suppose to create another xtemplate that will display other people's comment?'
', '', '
', '{img}
', '', '
', '
', '', 'Description:{description}
', 'Status:{status}
', '{chances}
', '
', '', '
', '
', '
', 'Other Comments
', '
', '
', '
', '
', '', '
'Thanks in advance.Pat.

mitchellsimoens
9 Oct 2012, 5:08 AM
What framework and version so I can move to the appropriate forum?

jay@moduscreate.com
9 Oct 2012, 6:47 AM
Pat,

It can be done easily by calling your XTemplates by globally accessible namespace.




var data = {
first : 'jay',
last : 'garcia'
};

Ext.ns('MyApp.tpls');

MyApp.tpls.lastName = Ext.create('Ext.XTemplate', '<b>{last}</b>');

MyApp.tpls.firstName = Ext.create('Ext.XTemplate', '<u>{first}</u>');

MyApp.tpls.getName = Ext.create('Ext.XTemplate',
'<div>',
'<span>Hello! My name is </span>',
'{[ MyApp.tpls.firstName.apply(values) ]}',
'{[ MyApp.tpls.lastName.apply(values) ]}',
'</div>'
);

console.log(MyApp.tpls.getName.apply(data))

jay@moduscreate.com
9 Oct 2012, 6:48 AM
Btw. *PLEASE* post in the proper forums!

Pat Emi
9 Oct 2012, 11:39 PM
What framework and version so I can move to the appropriate forum?
It's Extjs 4

Pat Emi
10 Oct 2012, 3:45 AM
I have tried this, it's not giving me any error message neither is it displaying.

Pat Emi
10 Oct 2012, 3:46 AM
Btw. *PLEASE* post in the proper forums!

I am using extjs 4, am i posting on the wrong forum.