Search code examples
javascriptextjsadditionnewrow

How to add new row to a html table in ExtJS


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?


Solution

  • 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.net/chrisramakers/xG3wq/

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