Touch the future...

XTemplate

上一篇 / 下一篇  2008-04-01 12:21:56 / 个人分类:Ext Javascript Library

Ext.onReady(function(){

     

   //

   vardata2 = {

       name:'Alice',

       children:[{

           age: 1,

           nickname:'blue'

       },{

           age: 2,

           nickname:'red'

       },{

           age: 10,

           nickname:'yellow'

       }]

   };/*

       //当改用数组作为数据源而其他格式不变时,XTemplate没有起作用!

   ,{

       name: 'Odavi',

       children:[{

           age: 2,

           nickname: 'orange'

       },{

           age: 8,

           nickname: 'black'

       }]

   }];

   */

   varp3 =newExt.Panel({

       title:'Customer XTemplate',

       width: 300,

       html:'text come here',

       renderTo: document.body,

       tbar:[{

           text:'apply XTemplate',

           handler:function(){

               vartpl =newExt.XTemplate(

                   '<ul><li>',

                   '<tpl for="children" if="name==\'Alice\'">',

                   //{#}返回的是子类在数组中出现的次序(由开始)

                   //{propertyname}不存在,返回空字符串

                   '<tpl if="age &lt; 3"><p>{#}. {parent.name},{n5ickname},{age}</p></tpl>',

                   '</tpl>',

                   '</li></ul>'

               );

               tpl.overwrite( p3.body, data2);

               p3.body.highlight('#22ee33',{block:true});

           }

       }]

   });

   

});


相关阅读:

TAG: ext xtemplate

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2008-07-25  
  12345
6789101112
13141516171819
20212223242526
2728293031  

数据统计

  • 访问量: 568
  • 日志数: 24
  • 文件数: 1
  • 书签数: 18
  • 建立时间: 2008-01-08
  • 更新时间: 2008-06-18

RSS订阅

Open Toolbar