0
 CODE :
 var data={"today date":'12-02-2014' ,"created date":'10-2-1014'}

   tpl= new Ext.XTemplate('<tpl for=".">','<p>{today date}</p>','<p>{created date}</p>','</tpl>');                                                

here I have attached the sample code.

user3062437
  • 347
  • 1
  • 2
  • 14
  • you use variable inside `{...}` in tpl. As it is variable, you can not have spaces. You can use underscore `_`. – Nandkumar Tekale Feb 25 '14 at 12:41
  • thank you @NandkumarTekale...But Iam not using the static variable to edit the key value Iam receiving it from web service that the problem i am facing with.Please give the solution for it.Thank you once again... – user3062437 Feb 25 '14 at 13:07

1 Answers1

0

Simple answer: don't.

var data = {"today date":'12-02-2014' ,"created date":'10-2-1014'};

// notice udpated variable names
var tpl = new Ext.XTemplate('<tpl for=".">','<p>{today_date}</p>','<p>{created_date}</p>','</tpl>');

var fixedData = {};
Ext.each(Ext.Object.getKeys(data), function(key) {
    fixedData[key.replace(/ /g, '_')] = data[key];
});

// test
alert(tpl.apply(fixedData));
rixo
  • 23,815
  • 4
  • 63
  • 68