Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Looking at the base <code>mx.controls.treeClasses.TreeItemRenderer</code> class, I see that in the <code>updateDisplayList</code> function the renderer gets it's <code>icon</code> and <code>disclosureIcon</code> classes from <code>_listData:TeeListData</code>. Instead of overriding the <code>updateDisplayList</code> function, try modifying the <code>icon</code> and <code>disclosureIcon</code> classes of the renderer's private <code>_listData</code> instance in your <code>_vSetIcon</code> method using the public accessors, like so:</p> <pre><code>private function _vSetIcon(icon:Class, disclosureIcon:Class = null):void { var tmpListData:TreeListData; if (disclosureIcon == null) disclosureIcon = icon; tmpListData = this.listData; tmpListData.icon = icon; tmpListData.disclosureIcon = disclosureIcon; this.listData = tmpListData; } </code></pre> <p><strong>EDIT</strong> </p> <p>Here is some clarification on the difference between <code>data</code> and <code>listData</code>. You'll have to excuse my omission of package names but I'm editing from my phone so its tough to look them up and I don't know the package names off the top of my head. <code>data</code> is defined in the context of a <code>TreeItemRenderer</code> in the <code>IDataRenderer</code> interface. You create a data renderer by implementing this interface and defining a public property <code>data</code>, which in this case is set by the parent control and contains some data and meta-data from the <code>dataProvider</code> to be rendered by the data renderer class. </p> <p><code>listData</code> is defined in the <code>IDropInListItemRenderer</code> interface as a property of type <code>BaseListData</code> and is realized in the <code>TreeItemRenderer</code> class as a property <code>TreeListData</code>. It differs from the <code>data</code> property in that it contains meta-data that describes the <code>TreeListRenderer</code> itself (icon, indent, open) as well as (I believe, I'll have to double check this later) a reference to the data item being rendered. I gather that It's used by the the <code>TreeItemRenderer</code> and I would imagine the parent list control for display update and sizing purposes. Someone is free to correct or add onto that if I'm incorrect or missed something, I'm going of what I remember drom the code.</p> <p>In this case, you wanted to use meta-data from the data set from the data provider to modify data that determines the display of the renderer, so you would need to modify both. </p> <p>I think the real confusion here however came from the fact that you extended the <code>TreeItemRenderer</code> class then tried to override functionality on the component in a manner the original developer didn't intend for someone to do, hence the unexpected results. If your goal is education and not ease of implementation you would probably be better served by extending the <code>UIComponent</code> class and using the <code>TreeItemRenderer</code> code as a reference to create a class that implements the same interfaces. That would be a real dive into the pool of custom component development.</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.
 

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