Using XTemplate with SimpleStore in Ext

Posted by qui on Stack Overflow See other posts from Stack Overflow or by qui
Published on 2008-12-08T16:59:35Z Indexed on 2010/04/12 5:03 UTC
Read the original article Hit count: 267

Filed under:
|
|

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"

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ext