我想循环遍历 dataGrid 中的所有项目并与特定项目进行比较

发布于 2024-12-20 00:51:29 字数 808 浏览 4 评论 0原文

我想循环遍历数据网格中的所有项目,并将它们与数据网格本身中存在的特定项目(唯一)进行比较,如果不相等,则该唯一项目(“我的管道” 是该特定项目的名称),我想将其与其余项目进行比较,然后删除该项目并移至下一个项目并再次比较。

intRowCount = Browser("Browser").appliaction("abc").FlexTitleWindow("Views").AdvancedDataGrid(dgView).GetItemsCount
For i=0 to intRowCount
 Browser("Browser").appliaction("abc").FlexTitleWindow("Views").AdvancedDataGrid(dgView).SelectIndex i
If Browser("Browser").appliaction("abc").FlexTitleWindow("Views").AdvancedDataGrid(dgView).GetROProperty("SelectedItem") <> Browser("Browser").appliaction("abc").FlexTitleWindow("Views").AdvancedDataGrid(dgView).GetROProperty("My Pipeline") Then
Browser("Browser").appliaction("abc").FlexTitleWindow("Views").FlexButton("Delete View").Click

我想循环遍历,直到删除除默认视图(我的管道)之外的所有其他视图。

请提出一些逻辑。

I want to loop through all the items in the datagrid and compare them with a particular item(unique) present in the datagrid itself, and if it is not equal that unique item ("My Pipeline" is the name of that particular item) with which i want to compare rest of the items with then delete that item and move on to the next item and compare again.

intRowCount = Browser("Browser").appliaction("abc").FlexTitleWindow("Views").AdvancedDataGrid(dgView).GetItemsCount
For i=0 to intRowCount
 Browser("Browser").appliaction("abc").FlexTitleWindow("Views").AdvancedDataGrid(dgView).SelectIndex i
If Browser("Browser").appliaction("abc").FlexTitleWindow("Views").AdvancedDataGrid(dgView).GetROProperty("SelectedItem") <> Browser("Browser").appliaction("abc").FlexTitleWindow("Views").AdvancedDataGrid(dgView).GetROProperty("My Pipeline") Then
Browser("Browser").appliaction("abc").FlexTitleWindow("Views").FlexButton("Delete View").Click

I want to loop through until all other views are deleted except my Default view (MY Pipeline).

Please suggest some logic.

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

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

发布评论

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

评论(1

安人多梦 2024-12-27 00:51:29

这是我实现的用于将数据从 DataGrid 下载到 CSV 文件的代码。
这可能对你有用。

请记住 dgSessionReport 是我的数据网格,first_name 和 last_name 是我的数据字段名称。

首先,我创建一个包含 csv 数据的字符串,然后将其写入扩展名为 .csv 的文件中。

您需要做的是在需要编写的第二个 for 循环中

if(searchString == dataProvider[i].first_name)
{
    dataProvider[i].first_name = "";
}

,这是我的代码

public function btnDownload_click():void
{
var csvData:String = "";

var columns:Array = dgSessionReport.columns;
var dataProvider:Object = dgSessionReport.dataProvider;

for(var i:int=0;i<columns.length;i++)
{
    if(i != columns.length - 1)
    {
        csvData += columns[i].headerText + ",";
    }
    else
    {
        csvData += columns[i].headerText;
    }
}
csvData += "\n";

for(var i:int=0;i<dataProvider.length;i++)
{
    csvData += dataProvider[i].first_name + ",";
    csvData += dataProvider[i].last_name;

    csvData += "\n";
}

var fileRef:FileReference = new FileReference();
fileRef.save(csvData,"Session Report.csv");

}

This is the code that i have implemented to download the data from DataGrid to CSV file.
This may be useful to you.

Remember dgSessionReport is my Datagrid, first_name and last_name is my datafield name.

First I am creating a String that contains csv data and then i am writing that into file having extension .csv

You need to do is in the 2nd for loop you need to write

if(searchString == dataProvider[i].first_name)
{
    dataProvider[i].first_name = "";
}

Here is my code

public function btnDownload_click():void
{
var csvData:String = "";

var columns:Array = dgSessionReport.columns;
var dataProvider:Object = dgSessionReport.dataProvider;

for(var i:int=0;i<columns.length;i++)
{
    if(i != columns.length - 1)
    {
        csvData += columns[i].headerText + ",";
    }
    else
    {
        csvData += columns[i].headerText;
    }
}
csvData += "\n";

for(var i:int=0;i<dataProvider.length;i++)
{
    csvData += dataProvider[i].first_name + ",";
    csvData += dataProvider[i].last_name;

    csvData += "\n";
}

var fileRef:FileReference = new FileReference();
fileRef.save(csvData,"Session Report.csv");

}

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