notinotinoti
15 Jul 2010, 6:11 PM
Hello, :-)
I want to display table with XTemplate.
My json data
[
{title:"Fund list", code:00001000, name:"fund 1"},
{title:"Fund list", code:00001001, name:"fund 2"},
{title:"Fund list", code:00001002, name:"fund 3"}
]
My Xtemplate
var myTpl = new Ext.XTemplate([
'<div class="listtitle"><strong>{title}</strong></div>',
'<tpl for=".">',
'<div class="jsondata">',
'<span class="code"><strong>{code}</strong></span>',
'<span class="name"> {name}</span>',
'</div>',
'</tpl>',
]);
and My List
var mylist = new Ext.List({
itemSelector: 'div.jsondata',
singleSelect: true,
tpl: myTpl
});
Current result is like this
--------------
--------------
512 fund1
--------------
513 fund2
--------------
514 fund2
--------------
(Title text is not displayed. I don`t know why )
I want to display like this.
--------------
Fund list
--------------
512 | fund1
--------------
513 | fund2
--------------
514 | fund2
--------------
In other word, first row is list header(title)
Second, third and forth row are contents that is separated columns.
Can I display a list that I mentioned?
Then... How to write XTemplate?
I want to display table with XTemplate.
My json data
[
{title:"Fund list", code:00001000, name:"fund 1"},
{title:"Fund list", code:00001001, name:"fund 2"},
{title:"Fund list", code:00001002, name:"fund 3"}
]
My Xtemplate
var myTpl = new Ext.XTemplate([
'<div class="listtitle"><strong>{title}</strong></div>',
'<tpl for=".">',
'<div class="jsondata">',
'<span class="code"><strong>{code}</strong></span>',
'<span class="name"> {name}</span>',
'</div>',
'</tpl>',
]);
and My List
var mylist = new Ext.List({
itemSelector: 'div.jsondata',
singleSelect: true,
tpl: myTpl
});
Current result is like this
--------------
--------------
512 fund1
--------------
513 fund2
--------------
514 fund2
--------------
(Title text is not displayed. I don`t know why )
I want to display like this.
--------------
Fund list
--------------
512 | fund1
--------------
513 | fund2
--------------
514 | fund2
--------------
In other word, first row is list header(title)
Second, third and forth row are contents that is separated columns.
Can I display a list that I mentioned?
Then... How to write XTemplate?