最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to add new row to a html table in ExtJS - Stack Overflow

programmeradmin0浏览0评论

Hello I have worked with regular tables and javascript to add new rows at the end of table, could someone help me out with adding new row containing html elements at the end of table?

Hello I have worked with regular tables and javascript to add new rows at the end of table, could someone help me out with adding new row containing html elements at the end of table?

Share Improve this question asked Mar 15, 2011 at 14:21 machamacha 7,49719 gold badges65 silver badges85 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

The easiest way is with an Ext.Template

var tpl = new Ext.Template(
    '<tr>',
        '<td>{0}</td>',
    '</tr>'
);
tpl.append('myTable', [ Ext.id() ]);

Check a working example here: http://jsfiddle/chrisramakers/xG3wq/

Updated example:
http://jsfiddle/chrisramakers/ZcQAX/

If you are dealing with a more plicated dom insert you might consider using a template created using Ext.DomHelper shown below.

var tpl = Ext.DomHelper.createTemplate({
    tag: 'tr', children: [{
        tag: 'td', html: '{0}'
    }]
});
tpl.append('myTable', [ Ext.id() ]);

http://dev.sencha./deploy/dev/docs/?class=Ext.DomHelper

发布评论

评论列表(0)

  1. 暂无评论