Flex 3 DataGrid 选项卡顺序

发布于 2025-01-07 04:54:09 字数 4852 浏览 0 评论 0原文

一段时间以来,我一直在尝试让制表符顺序在这个数据网格上工作,但我不知道我做错了什么。有人能发现吗?

<?xml version="1.0" encoding="utf-8"?>
<controls:MDataGrid xmlns:mx="http://www.adobe.com/2006/mxml" 
                xmlns:controls="com.iwobanas.controls.*" 
                xmlns:dgc="com.iwobanas.controls.dataGridClasses.*"
                dataProvider="{locator.vendorInvoices}">

<mx:Script>
    <![CDATA[
        import com.model.PayablesLocator;

        [Bindable] private var locator:PayablesLocator = PayablesLocator.getInstance();
    ]]>
</mx:Script>

<controls:columns>

    <dgc:MDataGridColumn dataField="loadNumber" 
                         headerText="Load"/>

    <dgc:MDataGridColumn dataField="carrierName" 
                         headerText="Carrier"/>

    <mx:DataGridColumn dataField="vendorInvoiceNumber" 
                       headerText="Vendor Invoice #"
                       rendererIsEditor="true"
                       editorDataField="vendorInvoiceNumber">
        <mx:itemRenderer>
            <mx:Component>
                <mx:HBox width="100%" height="100%" horizontalAlign="center" verticalAlign="middle">                        

                    <mx:Script>
                        <![CDATA[
                            protected function invoiceNumberInput_changeHandler(event:Event):void {
                                data.vendorInvoiceNumber = invoiceNumberInput.text;
                            }
                        ]]>
                    </mx:Script>

                    <mx:TextInput id="invoiceNumberInput"
                                  text="{data.vendorInvoiceNumber}"
                                  editable="true"
                                  width="95%"
                                  change="invoiceNumberInput_changeHandler(event)"/>
                </mx:HBox>
            </mx:Component>
        </mx:itemRenderer>
    </mx:DataGridColumn>

    <mx:DataGridColumn dataField="vendorInvoiceDate" 
                       headerText="Invoice Date"
                       rendererIsEditor="true"
                       editorDataField="vendorInvoiceDate">
        <mx:itemRenderer>
            <mx:Component>
                <mx:HBox width="100%" height="100%" horizontalAlign="center" verticalAlign="middle">

                    <mx:Script>
                        <![CDATA[
                            import mx.controls.Alert;
                            import mx.events.CalendarLayoutChangeEvent;
                            import mx.events.CloseEvent;

                            protected function invoiceDateChanged(event:CalendarLayoutChangeEvent):void {
                                data.vendorInvoiceDate = event.newDate;
                            }
                        ]]>
                    </mx:Script>

                    <mx:DateField id="vendorInvoiceDateInput"
                                  selectedDate="{data.vendorInvoiceDate}"
                                  editable="true"
                                  width="95%"
                                  change="invoiceDateChanged(event)"/>                      
                </mx:HBox>

            </mx:Component>
        </mx:itemRenderer>
    </mx:DataGridColumn>

    <mx:DataGridColumn dataField="isSelected"
                       headerText="Select" 
                       rendererIsEditor="true"
                       editorDataField="isSelected">
        <mx:itemRenderer>
            <mx:Component>
                <mx:HBox horizontalAlign="center" verticalAlign="middle">                       

                    <mx:Script>
                        <![CDATA[
                            import com.controller.PayablesController;

                            private var control:PayablesController = PayablesController.getInstance();

                            private function onCheckboxClick():void {

                                data.isSelected = selectionCheckBox.selected;
                                control.updateBatchSelections();
                            }
                        ]]>
                    </mx:Script>    

                    <mx:CheckBox id="selectionCheckBox"
                                 selected="{data.isSelected}"
                                 change="onCheckboxClick()"/>
                </mx:HBox>
            </mx:Component>
        </mx:itemRenderer>
    </mx:DataGridColumn>

</controls:columns>

我试图为每行获取如下选项卡顺序:供应商发票>发票日期>选择,但当我尝试跳到下一个字段时,它会跳转到浏览器的 URL(在本例中为 IE)。我尝试了网上找到的很多东西,但似乎都不起作用。

任何帮助将不胜感激。

——查理

I've been trying to get the tab order to work on this datagrid for some time now and I can't figure out what I am doing wrong. Can anyone spot it?

<?xml version="1.0" encoding="utf-8"?>
<controls:MDataGrid xmlns:mx="http://www.adobe.com/2006/mxml" 
                xmlns:controls="com.iwobanas.controls.*" 
                xmlns:dgc="com.iwobanas.controls.dataGridClasses.*"
                dataProvider="{locator.vendorInvoices}">

<mx:Script>
    <![CDATA[
        import com.model.PayablesLocator;

        [Bindable] private var locator:PayablesLocator = PayablesLocator.getInstance();
    ]]>
</mx:Script>

<controls:columns>

    <dgc:MDataGridColumn dataField="loadNumber" 
                         headerText="Load"/>

    <dgc:MDataGridColumn dataField="carrierName" 
                         headerText="Carrier"/>

    <mx:DataGridColumn dataField="vendorInvoiceNumber" 
                       headerText="Vendor Invoice #"
                       rendererIsEditor="true"
                       editorDataField="vendorInvoiceNumber">
        <mx:itemRenderer>
            <mx:Component>
                <mx:HBox width="100%" height="100%" horizontalAlign="center" verticalAlign="middle">                        

                    <mx:Script>
                        <![CDATA[
                            protected function invoiceNumberInput_changeHandler(event:Event):void {
                                data.vendorInvoiceNumber = invoiceNumberInput.text;
                            }
                        ]]>
                    </mx:Script>

                    <mx:TextInput id="invoiceNumberInput"
                                  text="{data.vendorInvoiceNumber}"
                                  editable="true"
                                  width="95%"
                                  change="invoiceNumberInput_changeHandler(event)"/>
                </mx:HBox>
            </mx:Component>
        </mx:itemRenderer>
    </mx:DataGridColumn>

    <mx:DataGridColumn dataField="vendorInvoiceDate" 
                       headerText="Invoice Date"
                       rendererIsEditor="true"
                       editorDataField="vendorInvoiceDate">
        <mx:itemRenderer>
            <mx:Component>
                <mx:HBox width="100%" height="100%" horizontalAlign="center" verticalAlign="middle">

                    <mx:Script>
                        <![CDATA[
                            import mx.controls.Alert;
                            import mx.events.CalendarLayoutChangeEvent;
                            import mx.events.CloseEvent;

                            protected function invoiceDateChanged(event:CalendarLayoutChangeEvent):void {
                                data.vendorInvoiceDate = event.newDate;
                            }
                        ]]>
                    </mx:Script>

                    <mx:DateField id="vendorInvoiceDateInput"
                                  selectedDate="{data.vendorInvoiceDate}"
                                  editable="true"
                                  width="95%"
                                  change="invoiceDateChanged(event)"/>                      
                </mx:HBox>

            </mx:Component>
        </mx:itemRenderer>
    </mx:DataGridColumn>

    <mx:DataGridColumn dataField="isSelected"
                       headerText="Select" 
                       rendererIsEditor="true"
                       editorDataField="isSelected">
        <mx:itemRenderer>
            <mx:Component>
                <mx:HBox horizontalAlign="center" verticalAlign="middle">                       

                    <mx:Script>
                        <![CDATA[
                            import com.controller.PayablesController;

                            private var control:PayablesController = PayablesController.getInstance();

                            private function onCheckboxClick():void {

                                data.isSelected = selectionCheckBox.selected;
                                control.updateBatchSelections();
                            }
                        ]]>
                    </mx:Script>    

                    <mx:CheckBox id="selectionCheckBox"
                                 selected="{data.isSelected}"
                                 change="onCheckboxClick()"/>
                </mx:HBox>
            </mx:Component>
        </mx:itemRenderer>
    </mx:DataGridColumn>

</controls:columns>

I'm trying to get the tab order as follows for each row: Vendor Invoice > Invoice Date > Select, but when I try to tab to the next field it jumps to the URL of the browser (IE in this case). I've tried a bunch of things found on the net, but none of them have seemed to work.

Any help would be greatly appreciated.

--Charly

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

も星光 2025-01-14 04:54:09

对此没有内置支持。如果您有可编辑的单元格,这将起作用,并且只有当您的编辑器实现 IFocusManagerComponent 时,它才起作用。 (在这种情况下,您的编辑器被包装在 HBox 中,而 HBox 则没有)。如果您使用的是 Spark 数据网格,则可以使用: http ://squaredi.blogspot.com/2011/09/ precision-focus-control-within-spark.html

There is no built in support for this. This will work if you have editable cells, and that too it will only work if your editors implement IFocusManagerComponent. (In this case your editors are wrapped inside HBoxes which do not). If you were using the spark datagrid, you could use : http://squaredi.blogspot.com/2011/09/precision-focus-control-within-spark.html

归属感 2025-01-14 04:54:09

结果工作代码:

<?xml version="1.0" encoding="utf-8"?>
<controls:MDataGrid xmlns:mx="http://www.adobe.com/2006/mxml" 
                xmlns:controls="com.iwobanas.controls.*" 
                xmlns:dgc="com.iwobanas.controls.dataGridClasses.*"
                dataProvider="{locator.vendorInvoices}"
                editable="true">

<mx:Script>
    <![CDATA[
        import com.model.PayablesLocator;

        [Bindable] private var locator:PayablesLocator = PayablesLocator.getInstance();
    ]]>
</mx:Script>

<controls:columns>

    <dgc:MDataGridColumn dataField="loadNumber" 
                         headerText="Load"
                         editable="false"/>

    <dgc:MDataGridColumn dataField="carrierName" 
                         headerText="Carrier"
                         editable="false"/>

    <mx:DataGridColumn dataField="vendorInvoiceNumber" 
                       headerText="Vendor Invoice #"
                       rendererIsEditor="true"
                       editorDataField="value">
        <mx:itemRenderer>
            <mx:Component>
                <mx:HBox width="100%" height="100%" horizontalAlign="center" verticalAlign="middle"
                         implements="mx.managers.IFocusManagerComponent">                       

                    <mx:Script>
                        <![CDATA[
                            [Bindable] public var value:String;

                            override public function drawFocus(draw:Boolean):void {
                                invoiceNumberInput.setFocus();
                            }
                        ]]>
                    </mx:Script>

                    <mx:TextInput id="invoiceNumberInput"
                                  text="{value}"
                                  width="95%"/>

                </mx:HBox>
            </mx:Component>
        </mx:itemRenderer>
    </mx:DataGridColumn>

    <mx:DataGridColumn dataField="vendorInvoiceDate" 
                       headerText="Invoice Date"
                       rendererIsEditor="true"
                       editorDataField="value">
        <mx:itemRenderer>
            <mx:Component>
                <mx:HBox width="100%" height="100%" horizontalAlign="center" verticalAlign="middle"
                         implements="mx.managers.IFocusManagerComponent">                       

                    <mx:Script>
                        <![CDATA[
                            [Bindable] public var value:Date;

                            override public function drawFocus(draw:Boolean):void {
                                vendorInvoiceDateInput.setFocus();
                            }
                        ]]>
                    </mx:Script>

                    <mx:DateField id="vendorInvoiceDateInput"
                                  selectedDate="{value}"
                                  editable="true"
                                  width="95%"/>

                </mx:HBox>
            </mx:Component>
        </mx:itemRenderer>
    </mx:DataGridColumn>

    <mx:DataGridColumn editorDataField="isSelected"
                       headerText="Select"
                       rendererIsEditor="true">         
        <mx:itemRenderer>
            <mx:Component>

                <mx:HBox width="100%" height="100%" horizontalAlign="center" verticalAlign="middle"
                         implements="mx.controls.listClasses.IDropInListItemRenderer,mx.managers.IFocusManagerComponent">

                    <mx:Script>
                        <![CDATA[
                            import com.controller.PayablesController;

                            import mx.controls.dataGridClasses.DataGridListData;
                            import mx.controls.listClasses.BaseListData;

                            private var control:PayablesController = PayablesController.getInstance();

                            private var _listData:DataGridListData;
                            [Bindable] public var isSelected:Boolean;

                            override public function drawFocus(draw:Boolean):void {
                                selectionCheckBox.setFocus();
                            }

                            override public function get data():Object {
                                return super.data;

                            }   

                            override public function set data(value:Object):void {
                                super.data = value;
                                selectionCheckBox.selected = data.isSelected
                            }

                            public function get listData():BaseListData {
                                return _listData;
                            }   

                            public function set listData(value:BaseListData):void {
                                _listData = DataGridListData(value);
                            }

                            protected function onChange(event:Event):void {
                                data.isSelected = selectionCheckBox.selected;
                                control.updateBatchSelections();
                            }                               
                        ]]>
                    </mx:Script>  

                    <mx:CheckBox id="selectionCheckBox" change="onChange(event)"/>

                </mx:HBox>

            </mx:Component>
        </mx:itemRenderer>
    </mx:DataGridColumn>

</controls:columns>

Resulting working code:

<?xml version="1.0" encoding="utf-8"?>
<controls:MDataGrid xmlns:mx="http://www.adobe.com/2006/mxml" 
                xmlns:controls="com.iwobanas.controls.*" 
                xmlns:dgc="com.iwobanas.controls.dataGridClasses.*"
                dataProvider="{locator.vendorInvoices}"
                editable="true">

<mx:Script>
    <![CDATA[
        import com.model.PayablesLocator;

        [Bindable] private var locator:PayablesLocator = PayablesLocator.getInstance();
    ]]>
</mx:Script>

<controls:columns>

    <dgc:MDataGridColumn dataField="loadNumber" 
                         headerText="Load"
                         editable="false"/>

    <dgc:MDataGridColumn dataField="carrierName" 
                         headerText="Carrier"
                         editable="false"/>

    <mx:DataGridColumn dataField="vendorInvoiceNumber" 
                       headerText="Vendor Invoice #"
                       rendererIsEditor="true"
                       editorDataField="value">
        <mx:itemRenderer>
            <mx:Component>
                <mx:HBox width="100%" height="100%" horizontalAlign="center" verticalAlign="middle"
                         implements="mx.managers.IFocusManagerComponent">                       

                    <mx:Script>
                        <![CDATA[
                            [Bindable] public var value:String;

                            override public function drawFocus(draw:Boolean):void {
                                invoiceNumberInput.setFocus();
                            }
                        ]]>
                    </mx:Script>

                    <mx:TextInput id="invoiceNumberInput"
                                  text="{value}"
                                  width="95%"/>

                </mx:HBox>
            </mx:Component>
        </mx:itemRenderer>
    </mx:DataGridColumn>

    <mx:DataGridColumn dataField="vendorInvoiceDate" 
                       headerText="Invoice Date"
                       rendererIsEditor="true"
                       editorDataField="value">
        <mx:itemRenderer>
            <mx:Component>
                <mx:HBox width="100%" height="100%" horizontalAlign="center" verticalAlign="middle"
                         implements="mx.managers.IFocusManagerComponent">                       

                    <mx:Script>
                        <![CDATA[
                            [Bindable] public var value:Date;

                            override public function drawFocus(draw:Boolean):void {
                                vendorInvoiceDateInput.setFocus();
                            }
                        ]]>
                    </mx:Script>

                    <mx:DateField id="vendorInvoiceDateInput"
                                  selectedDate="{value}"
                                  editable="true"
                                  width="95%"/>

                </mx:HBox>
            </mx:Component>
        </mx:itemRenderer>
    </mx:DataGridColumn>

    <mx:DataGridColumn editorDataField="isSelected"
                       headerText="Select"
                       rendererIsEditor="true">         
        <mx:itemRenderer>
            <mx:Component>

                <mx:HBox width="100%" height="100%" horizontalAlign="center" verticalAlign="middle"
                         implements="mx.controls.listClasses.IDropInListItemRenderer,mx.managers.IFocusManagerComponent">

                    <mx:Script>
                        <![CDATA[
                            import com.controller.PayablesController;

                            import mx.controls.dataGridClasses.DataGridListData;
                            import mx.controls.listClasses.BaseListData;

                            private var control:PayablesController = PayablesController.getInstance();

                            private var _listData:DataGridListData;
                            [Bindable] public var isSelected:Boolean;

                            override public function drawFocus(draw:Boolean):void {
                                selectionCheckBox.setFocus();
                            }

                            override public function get data():Object {
                                return super.data;

                            }   

                            override public function set data(value:Object):void {
                                super.data = value;
                                selectionCheckBox.selected = data.isSelected
                            }

                            public function get listData():BaseListData {
                                return _listData;
                            }   

                            public function set listData(value:BaseListData):void {
                                _listData = DataGridListData(value);
                            }

                            protected function onChange(event:Event):void {
                                data.isSelected = selectionCheckBox.selected;
                                control.updateBatchSelections();
                            }                               
                        ]]>
                    </mx:Script>  

                    <mx:CheckBox id="selectionCheckBox" change="onChange(event)"/>

                </mx:HBox>

            </mx:Component>
        </mx:itemRenderer>
    </mx:DataGridColumn>

</controls:columns>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文