在 Adob​​e flex 中重新加载 Grid 后如何修复 Gridview

发布于 2024-10-15 18:25:30 字数 726 浏览 3 评论 0原文

我已经搜索了很多,但找不到执行此操作的确切方法...... 如果你看一下这个页面,你就会更好地理解。 飞思卡尔 。请在 IE 中打开它。这是我的场景...

单击左侧导航栏中的 Analog & 下的 om power Actuation。电源管理。您将获得结果表,上面我有一个显示不同过滤条件的容器。现在找到一个位于屏幕右侧折叠之外的可过滤标题(将标题名称与过滤标题匹配)。然后为过滤练习选择一个值,并按它进行过滤。

now here my problem arises

重新加载结果后,表视图返回到其起始位置,这会给最终用户带来关于结果的困惑。

所以我的问题是我怎样才能防止我的表格视图回到它的起点?
我希望我的结果应该是这样的..
选择值进行过滤,过滤开始,重新加载的值出现在相同的屏幕位置,与选择值之前一样

我考虑了viewStack但无法弄清楚如何做什么?
任何建议或解决方案将受到高度赞赏!!!!
预先感谢您花费宝贵的时间阅读我的问题。

i have searched a lot but could not find the exact way to do this...
you will understand better if you will look once this page. freescale .please open this in IE.Here is my scenario...

click om power Actuation present in leftnav under Analog & Power Management. you will get result table and above that i have a container which shows different filter criteria. now find a filterable header(match header name with filter header) that is out of the screen fold to the right.then Choose a value for filter exercise, filter by it.

now here my problem arises

after reloading the results, the table-view comes back to it's starting position, which creates the confusion to end user about the results.

so my question is how can i prevent my table-view to gets back to it's starting point?
i want my result should appear like this..
Value is chosen for filtering, filtering starts, the reloaded values appear in the same screen position, as before the value was chosen

i thought about viewStack but could not figure about how to do?
any suggestion or solution will highly appreciated!!!!!
Thanks in advance for your valuable time which you spend to read my question.

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

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

发布评论

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

评论(1

水水月牙 2024-10-22 18:25:30

单击过滤器后,将数据网格的“horizo​​ntalScrollPosition”存储在变量中。然后在将数据加载到表中后,将水平滚动位置重置回来。

我在下面提供了一个示例。在这个示例中,有一个数据网格和一个按钮。单击按钮时,数据将被加载,并且我在加载数据后通过设置“horizo​​ntalScrollPosition”值来保持滚动位置。

<mx:DataGrid id="dataGridsfgh"
             left="15"
             top="41"
             dataProvider="{employeeList}"
             width="100%"
             horizontalScrollPolicy="on">
    <mx:columns>
        <mx:DataGridColumn headerText="First Name"
                           dataField="firstname"
                           width="40"/>
        <mx:DataGridColumn headerText="Last Name"
                           dataField="lastname"
                           width="40"/>
        <mx:DataGridColumn headerText="Designation"
                           dataField="designation"
                           width="40"/>
        <mx:DataGridColumn headerText="Contact # (Desk)"
                           dataField="deskphone"
                           width="40"/>
        <mx:DataGridColumn headerText="Contact # (Mobile)"
                           dataField="mobilephone"
                           width="40"/>
        <mx:DataGridColumn headerText="Contact # (Home)"
                           dataField="resphone"
                           width="40"/>
        <mx:DataGridColumn headerText="Address"
                           dataField="address1"
                           width="40"/>
        <mx:DataGridColumn headerText="Address"
                           dataField="address2"
                           width="40"/>
        <mx:DataGridColumn headerText="State"
                           dataField="state"
                           width="40"/>
        <mx:DataGridColumn headerText="Zip"
                           dataField="zip"
                           width="40"/>
        <mx:DataGridColumn headerText="Country"
                           dataField="country"
                           width="40"/>
    </mx:columns>
</mx:DataGrid>
<mx:Button x="36"
           y="228"
           label="Save position"
           click="addData();"/>

Actionscript 代码:

    private function addData():void
        {
            var temp:int=dataGridsfgh.horizontalScrollPosition;
            var employeeObj:Object=new Object();
            employeeObj.firstname="John";
            employeeObj.lastname="Henry";
            employeeObj.designation="Developer";
            employeeObj.deskphone="XXX-XXX-XXXX";
            employeeObj.mobilephone="XXX-XXX-XXXX";
            employeeObj.resphone="XXX-XXX-XXXX";
            employeeObj.address1="#XXX Seawall Blvd";
            employeeObj.address2="Apt # XXX";
            employeeObj.location="Maui";
            employeeObj.state="Hawaii";
            employeeObj.zip="XXXXX";
            employeeObj.country="U.S";
            employeeList.addItem(employeeObj);
            dataGridsfgh.dataProvider=employeeList;
            dataGridsfgh.invalidateDisplayList();
            dataGridsfgh.horizontalScrollPosition=temp;
        }

希望这有帮助!

Store the 'horizontalScrollPosition' of the datagrid in a variable as soon as you click the filter.Then after loading the data in the table, reset the horizontalscrollposition back.

I have provided an example below.In this example there is a datagrid and a button. On click of the button data gets loaded and I maintain the scroll position by setting the 'horizontalScrollPosition' value after loading the data.

<mx:DataGrid id="dataGridsfgh"
             left="15"
             top="41"
             dataProvider="{employeeList}"
             width="100%"
             horizontalScrollPolicy="on">
    <mx:columns>
        <mx:DataGridColumn headerText="First Name"
                           dataField="firstname"
                           width="40"/>
        <mx:DataGridColumn headerText="Last Name"
                           dataField="lastname"
                           width="40"/>
        <mx:DataGridColumn headerText="Designation"
                           dataField="designation"
                           width="40"/>
        <mx:DataGridColumn headerText="Contact # (Desk)"
                           dataField="deskphone"
                           width="40"/>
        <mx:DataGridColumn headerText="Contact # (Mobile)"
                           dataField="mobilephone"
                           width="40"/>
        <mx:DataGridColumn headerText="Contact # (Home)"
                           dataField="resphone"
                           width="40"/>
        <mx:DataGridColumn headerText="Address"
                           dataField="address1"
                           width="40"/>
        <mx:DataGridColumn headerText="Address"
                           dataField="address2"
                           width="40"/>
        <mx:DataGridColumn headerText="State"
                           dataField="state"
                           width="40"/>
        <mx:DataGridColumn headerText="Zip"
                           dataField="zip"
                           width="40"/>
        <mx:DataGridColumn headerText="Country"
                           dataField="country"
                           width="40"/>
    </mx:columns>
</mx:DataGrid>
<mx:Button x="36"
           y="228"
           label="Save position"
           click="addData();"/>

Actionscript Code:

    private function addData():void
        {
            var temp:int=dataGridsfgh.horizontalScrollPosition;
            var employeeObj:Object=new Object();
            employeeObj.firstname="John";
            employeeObj.lastname="Henry";
            employeeObj.designation="Developer";
            employeeObj.deskphone="XXX-XXX-XXXX";
            employeeObj.mobilephone="XXX-XXX-XXXX";
            employeeObj.resphone="XXX-XXX-XXXX";
            employeeObj.address1="#XXX Seawall Blvd";
            employeeObj.address2="Apt # XXX";
            employeeObj.location="Maui";
            employeeObj.state="Hawaii";
            employeeObj.zip="XXXXX";
            employeeObj.country="U.S";
            employeeList.addItem(employeeObj);
            dataGridsfgh.dataProvider=employeeList;
            dataGridsfgh.invalidateDisplayList();
            dataGridsfgh.horizontalScrollPosition=temp;
        }

Hope this helps!

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