Last Updated: February 25, 2016
· rodnaph

ExtJS XTemplate with Models

Unfortunately XTemplate templates in ExtJS 4 have no support for accessing the models your give them to iterate over. They're all converted to plain objects first.

Maddening... :E

So if you need to get some custom data into your templates that you'd usually call a model method for (eg. model.getThumbnailUrl() or something...) you need to override the getAssociatedData() method.

Ext.define('', {
  extend: '',
  getAssociatedData: function() {
    return {
      foo: 'bar',
      thumbUrl: this.getThumbnailUrl()

I don't know where else this is used though... so take care!