Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I use a TreeStore with 'auto' mappings?
    primarykey
    data
    text
    <p>I have a model that looks like this:</p> <pre><code>Ext.regModel('TreeItem', { fields: [ { name: 'ItemId', type: 'int' }, { name: 'ItemType', type: 'string' }, { name: 'Article', type: 'auto' }, { name: 'Container', type: 'auto' }, { name: 'Category', type: 'auto'}] }); </code></pre> <p>The ItemType indicates whether that specific item should be rendered as an Article, Container, or Category. Each of the Article, Container, and Category objects has an associated ArticleName, ContainerName, and CategoryName.</p> <p>I'd like to render these names in a NestedList based on the record's ItemType. So I overrode the getItemTextTpl like this:</p> <pre><code>getItemTextTpl: function (recordnode) { var template = '&lt;div class="{ItemType}-icon"&gt;&lt;/div&gt;'; if (recordnode.firstChild.attributes.record.data["ItemType"] == 'Article') { template += recordnode.firstChild.attributes.record.data['Article']["ArticleName"]; } if (recordnode.firstChild.attributes.record.data["ItemType"] == 'Container') { template += recordnode.firstChild.attributes.record.data['Container']["ContainerName"]; } if (recordnode.firstChild.attributes.record.data["ItemType"] == 'Category') { template += recordnode.firstChild.attributes.record.data['Category']["CategoryName"]; } return template; } </code></pre> <p>However, it appears that getItemTextTpl is only called once for each level of the tree, so there's no way to render the information for each list item. </p> <p>Does anyone have suggestions on how to accomplish this? Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload