Threaded View

  1. #1
    Sencha User
    Join Date
    Dec 2010
    Vote Rating
    francescosyd is on a distinguished road


    Default Answered: Sencha Architect XTemplate scope

    I'm trying to set a scope variable on the itemTpl in an Ext.dataview.List in architect 3.0 Does anyone know how to do this? I can add a scope property on the itemTpl but it seems to convert 'this' to a string.thanksFrancesco

  2. Hi Jason,thanks for the pointer :-) I like using the itemTpl editor in Sencha Architect as it makes it easy to spot mistakes and add template functions. So I kept my template in the lists itemTpl property and added the following on the lists initialize method://re-create template so it compiles to include scopevar itemTpl = this.getItemTpl();itemTpl.scope = this;this.setItemTpl(Ext.create('Ext.XTemplate',itemTpl.html, itemTpl));Now my template functions have access to the required scope via this.scope and I still get to use Architects XTemplate editor.Thanks againFrancesco

Thread Participants: 1