简体   繁体   中英

Editing data inside Ext.XTemplate which is inside Ext.Panel

I have to edit data inside my template that is use for Ext.Panel. How can I do this ? I tried to add listener, but click event did not bind click to that panel.

Ext.XTemplate:

MyApp.ext.MyExtension.prototype.mytpl = new Ext.XTemplate(
        '<tpl for=".">',
        '<table class="my">',
        '<tr><th>Item:</th><td>{itemIWantToEdit}</td></tr>',
        '</table>',
        '</tpl>'
        ).compile();

Ext.Panel:

var myPanel = new Ext.Panel({
                xtype: 'panel',
                region: 'east',
                title: 'MyPanel',
                split: true,
                width: 220,
                collapsible: true,
                layout: 'fit'
                // etc...

Looking at the tpl implementation in Ext.Panel you should be able to alter the tpl of an existing Panel by just overwriting the tpl property with a new XTemplate instance.

// Create panel
var myPanel = new Ext.Panel(...);

// Later, somewhere else, in a listener for example
myPanel.tpl = new Ext.XTemplate('<tpl for="."> ... </tpl>');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM