views:

834

answers:

1

I am currently adding some functionality to some old code. There used to be a template which took a flat array of items and spat out some HTML, now the data is coming from a simple store which reads some JSON..

    var allwords = [


['abacteriano', 'abacteriano'],


  ['abacterial', 'abacteriano'],

['abciximab', 'abciximab'], etc..

So my simplestore goes like this:

    termStore = new Ext.data.SimpleStore({
    fields: ['term', 'lookup'],
    data: allwords
});

This definitly works fine as I use the termStore in a combobox. However I am having difficulty getting it to play with an XTemplate.

It seems the syntax in extjs doesn't play well with SO, so this bit wont be in a code block...

So I guess I'll describe it :p

Essentially its a simple template which tries to get values out of the passed collection by doing {term}

I then try and apply it by doing:

tpl.overwrite(Ext.get("contentbox"), termStore);

This gives me a JS error of "invalid object initializer"

A: 

XTemplate works with simple objects or arrays, not afaik, simplestores. Try binding it to your allwords array instead.