为什么AdvancedDataGrid呈现所有列而不是可见列?

时间:2012-07-26 19:46:38

标签: performance flash flex

所以我知道DataGrid假设的行为只是渲染可见的单元格。但是在我的应用程序中,我发现数据网格为每个可见行呈现所有列。有什么想法会发生这种情况吗?

每列都有自己的自定义itemRenderer,基于类型:

public class CustomColumn extends AdvancedDataGridColumn {
    public function CustomColumn() {
        switch (this.type) {
            case A: this.itemRenderer = RendererA;
            break;
            case B: this.itemRenderer = RendererB;
            break;
            // more similar code
    }
}

谢谢!

编辑:网格属性。 CustomAdvancedDataGrid扩展了AdvancedDataGrid。

<view:CustomAdvancedDataGrid
    id="grid"  
    wordWrap="true"
    alternatingItemColors="[#ffffff,#ffffff]"
    horizontalGridLines="true"
    width="100%"
    height="100%"

    fontSize="11"
    paddingTop="4"
    paddingBottom="6" 
    lockedColumnCount="1"
    verticalLockedSeparatorSkin="{greyLine}"

    styleName="gridRowSelection"
    headerStyleName="gridHeaderGreen"

    dataProvider="{resetGrid(gridModel.hd)}"
    updateComplete="gridUpdateCompleteHandler(event)"

    displayDisclosureIcon="true"
    iconFunction="iconFunction"
    useRollOver="false"

    sortableColumns="false"
    editable="{!this.gridModel.isReadOnly() &amp;&amp; !this.model.budgetGridModel.tagsMenuShowing}"

    draggableColumns="false"
    dragEnabled="{!this.gridModel.isReadOnly() &amp;&amp; (this.gridModel.currColumnDef == null)}"
    dropEnabled="true"
    dragMoveEnabled="true"
    dragStart="dragPreventHandler(event)"
    dragEnter="dragPreventHandler(event)"
    dragDrop="dragDropHandler(event)"
    dragOver="dragOverHandler(event)"
    dragComplete="dragCompleteHandler(event)"

    itemClick="itemClickHandler(event)"
    itemEditBegin="itemEditBeginHandler(event)"
    itemEditBeginning="itemEditBeginningHandler(event)"
    itemEditEnd="itemEditEndHandler(event)"

    scroll="scrollHandler(event)"
    horizontalScrollPolicy="on"
    verticalScrollPolicy="on"
    liveScrolling="false"

    focusThickness="0"
    variableRowHeight="false"
    selectionColor="#f8fac8"
    disclosureClosedIcon="@Embed(source='../asf/icon_plus_expand.png')"
    disclosureOpenIcon="@Embed(source='../asf/icon_minus_minimize.png')"
    headerRenderer="ADGHeaderRenderer"
    getHighLightedColorFunction="getHighLightedColorFunction"
    columnStretch="columnStretchHandler(event)"

    rowColorFunction="rowColourFunction"
    columns="{gridModel.columnHier}"

    displayItemsExpanded="true"
    itemOpen="this.itemOpened(event)"
    itemClose="this.itemClosed(event)"/>

1 个答案:

答案 0 :(得分:0)

AdvancedDataGrid有两个用于设置列的属性:groupedColumns和columns。 设置groupedColumns将为所有列实例化渲染器(水平滚动将平稳运行,但网格需要更多时间进行渲染)。 设置列 - 仅显示可见区域中的渲染器。