开发者

Adapting the width of a Flexs 3 DataGridColumn to the content of its ItemRenderer?

I have the following scenario :

  • A Flex 3 DataGrid is sitting here
  • At runtime, a column is added to this grid
  • The column has a custom ItemRenderer
  • The ItemRenderer inherits from HBox, and adds a few items to the HBOx dynamically

My problem is that the width of the column doesn't change. 开发者_运维技巧As a consequence, my column stays small, and an ugly horizontal scrollbar is displayed in the line, instead of my content (which is completely unreadable).

I would like the column to adapt its width to the content of the HBox in the ItemRenderer. I tried the following :

  • Setting the 'percentWidth' of the ItemRenderer to '100'
  • Invalidating the properties of the ItemRenderer after adding the items

The only thing that has a "visible" effect it to force the width of the DataGridColumn. Obviously this is not acceptable since I'm dynamically adding components to the ItemRenderer, and I don't know how many or how big they are.

Besides, when I am in the ItemRenderer, I have no access to the column itself (or do I ?) so I cannot force the size of the column from here.

So is there a way around this ? Would AdvancedDataGrid help here (notwhistanding the fact that I cannot really use it for other reasons ...)

Alternatively, I would be happy enough if someone has a solution where the column cell is displayed without the ugly horizontal scrollbar (don't mention setting horizontalScrollPolicy to "off", been there, tried that, lost shirt ;) ).

Thanks

PH


I did not found a solution for the size, however I found the way to remove the scrollbar ; you must put the "horizontalScrollPolicy : 'off'" in the list of properties of the itemRenderer Factory (rather then on the itemRenderer itself).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜