Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 如何垂直制表而不是水平制表_Actionscript 3_Datagrid_Flex4.5 - Fatal编程技术网

Actionscript 3 如何垂直制表而不是水平制表

Actionscript 3 如何垂直制表而不是水平制表,actionscript-3,datagrid,flex4.5,Actionscript 3,Datagrid,Flex4.5,我在Flex中工作,试图让sparks datagrid垂直制表,而不是水平制表 var hBox:HBox = new HBox(); var templateDataGrid:spark.components.DataGrid = new spark.components.DataGrid(); templateDataGrid.dataProvider = dataGridList; templateDataGrid.columns = columnHeaders; templateDat

我在Flex中工作,试图让sparks datagrid垂直制表,而不是水平制表

var hBox:HBox = new HBox();
var templateDataGrid:spark.components.DataGrid = new spark.components.DataGrid();
templateDataGrid.dataProvider = dataGridList;
templateDataGrid.columns = columnHeaders;
templateDataGrid.sortableColumns = false;
templateDataGrid.editable = true;
hBox.addElement(templateDataGrid);
有一个非常简单的as3实现,我正在HBox中呈现

这里有一个完整的API工作示例,我正在用as3而不是mxml编写网格,但我可以翻译

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
           xmlns:s="library://ns.adobe.com/flex/spark">

<s:Panel title="Spark DataGrid Control Example which demonstrates the variableRowHeight and rowHeight properties"
         width="75%" height="75%" 
         horizontalCenter="0" verticalCenter="0">

    <s:controlBarContent>
        <s:HGroup verticalAlign="baseline">
            <s:CheckBox label="variableRowHeight={dataGrid.variableRowHeight}" selected="@{dataGrid.variableRowHeight}"/>
            <s:Label text="      "/> <!-- blank space -->
            <s:HSlider minimum="12" maximum="120" value="@{dataGrid.grid.rowHeight}"/>
            <s:Label text="rowHeight={dataGrid.grid.rowHeight}"/>
        </s:HGroup>
    </s:controlBarContent>    

    <s:DataGrid id="dataGrid" left="5" right="5" top="5" bottom="5" editable="true">
        <s:ArrayCollection>
            <s:DataItem key="1000" name="Abrasive" price="100.11" call="false"/>
            <s:DataItem key="1001" name="Brush" price="110.01" call="true"/>
            <s:DataItem key="1002" name="Clamp" price="120.02" call="false"/>
            <s:DataItem key="1003" name="Drill" price="130.03" call="true"/>
            <s:DataItem key="1004" name="Epoxy" price="140.04" call="false"/>
            <s:DataItem key="1005" name="File" price="150.05" call="true"/>
            <s:DataItem key="1006" name="Gouge" price="160.06" call="false"/>
            <s:DataItem key="1007" name="Hook" price="170.07" call="true"/>
            <s:DataItem key="1008" name="Ink" price="180.08" call="false"/>
            <s:DataItem key="1009" name="Jack" price="190.09" call="true"/>             
        </s:ArrayCollection>
    </s:DataGrid>
</s:Panel>
</s:Application>


如果要查看网格,可以在中查看网格示例,并在水平移动时查看。我想让它垂直移动

这是我到目前为止的资料。它的工作原理是,当用户释放tab键时,它会查看他们所在的位置,并转到不同的位置。(在我的例子中是向下的一个。)内置选项卡导航发生在
键向下
上,这发生在
键向上
上。因此,选定的项目可能不是最好的。这适用于
GridSelectionMode.SINGLE\u CELL
的位置

myGrid.addEventListener(KeyboardEvent.KEY_UP, selectionChangingHandler);

private function selectionChangingHandler(event:KeyboardEvent):void
{
    if(event.keyCode == Keyboard.TAB){
        var selectedCell:CellPosition = event.currentTarget.selectedCell;
        var columnLength = event.currentTarget.grid.columns.length;
        var rowLength = event.currentTarget.grid.dataProvider.length;
        var columnIndex:Number = selectedCell.columnIndex;
        var rowIndex:Number = selectedCell.rowIndex+1;

        if(rowLength == rowIndex){
            if(columnIndex == columnLength-1){
                columnIndex = 0;
                rowIndex = 0;
            }else{
                columnIndex = columnIndex+1;
                rowIndex = 0;
            }
        }
        var success:Boolean = event.currentTarget.startItemEditorSession(rowIndex,columnIndex);
        event.currentTarget.setSelectedCell(rowIndex,columnIndex);
    }
}

这可能是helpful@www0z0k如示例所示,
s:Datagrid
不会将其行和列显示为DisplayObjects,而是与arraycollection接口。所以这个链接与这个问题没有直接关系。