0

所以我知道 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)"/>
4

1 回答 1

0

AdvancedDataGrid has two properties to set columns: groupedColumns and columns. Set groupedColumns will instantiate renderers for all columns (horizontal scroll will works smoothly but grid need more time for rendering). Set columns - only renderers in visible area.

于 2012-07-26T20:20:04.377 回答