开发者

Show itemRenderer in specific DataGrid rows... others empty

I have a DataGrid populated via an Array. The last column in the DataGrid uses an ItemRenderer (Button). I want to show the Button in certain rows but not in others (leave those empty). I've looked everywhere for an example or even a clue how to do this (开发者_JAVA技巧tried labelFunction on DG, etc.) but can't find anything about it. Any help would be appreciated. Thanks!


Okay... with (lots of) help, figured it out. First off, I'm not sure why the itemRenderer requires a container but it does. The array must also be checked from the itemRenderer and not from the main application... again, I don't know why since the debugger shows it going through the exact same loop/events, etc.). If interested here's the relevant parts of the code:

Main App:---

{col1:'', col2:'', col3:'', col4:'', col5:'', col6:'', col7: '', col8:'', col9:'', col10:'', col11:'yo'}];

public function initData():void { xferSchedule.dataProvider = schedArray; } ]]>


an item renderer does not have to be a container, it has to implement IDataRenderer (a Button does not). One could extend Button and implement this interface to get a simple button renderer. If you want it to display conditionally, you will accomplish this by handling those conditions within the renderer based on the data.


Now this might get slightly complex. I would recommend you to define you an XML instead of Array of Objects. If the node has the type property button, then it would create button at that cell whose value type is button.

How to create a button dynamically inside a grid which is yet again dynamic?

This might end into the whole component being dynamic.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜