Using XTemplate with SimpleStore in Ext

I am currently adding some functionality to the old code. There used to be a template that took a flat array of elements and gave out some HTML, now the data comes from a simple store that reads a little JSON.

var allwords = [
['abacteriano', 'abacteriano'],
['abacterial', 'abacteriano'],
['abciximab', 'abciximab'], etc..

      

So my simple store looks like this:

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

      

This definitely works well since I use the term "Store" in the dropdown. However, I'm having a hard time getting it to play with the XTemplate.

The syntax in extjs doesn't seem to work very well with SO, so this bit won't be in the code block ...

I think I'll describe it: p

Basically, this is a simple template that tries to get values ​​from a passed collection by doing {term}

Then I try to apply it by doing:

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

      

This gives me the JS error "invalid object initializer"

+2


source to share


1 answer


The XTemplate works with simple objects or arrays, not afaik, simpleestores. Try to bind it to your allwords array.



0


source







All Articles