如何在基础设施igniteui网格中选择单列数据 [英] how to select single column data in infragistics igniteui grid

查看:93
本文介绍了如何在基础设施igniteui网格中选择单列数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从网格数据中选择单列数据. 网格数据按以下方式传递:

how to select data of single column from a grid data. The grid data is passed as following:

var url = "/Main/Grid?tbname="+parameter;
var jsonp = new $.ig.JSONPDataSource({
           dataSource: url, paging: {
               enabled: true, pageSize: 10,
               type: "remote"
           }
       });

$(#listingGrid").igGrid("dataSourceObject",jsonp).igGrid("dataBind");

$("#listingGrid").igGrid("dataSourceObject", jsonp).igGrid("dataBind");

我必须从该网格中检索另一页中的数据,然后从该数据中选择一列.

I have to retrieve data in another page from this grid and select one column from this data.

我已经检索到了这样的数据

and i have retrieved data like this

var ds = window.parent.$("#listingGrid").igGrid("option", "dataSource");

但无法访问一列数据.

推荐答案

我假设由于您正在使用数据源直接表示您不想要网格中的实际列,这可能与数据源中的列不同,具体取决于您如何设置网格.

I'm assuming that since you are using the DataSource directly that you don't want the actual columns in the grid, which might differ from the columns in the data source depending on how you have the grid set up.

最简单的方法可能是一旦从其他页面检索到数据功能,就从数据源中调用该数据功能.此函数返回一个对象数组,这些对象是每一行中的项目.一旦有了,就可以遍历每个项目并查询单个属性.

The easiest way to go about this would probably be to call the data function off of the data source once you retrieve it from your other page. This function returns an array of objects that are the items in each row. Once you have that you can iterate over each of the items and query the individual property.

var ds = window.parent.$('#listingGrid').igGrid('option', 'dataSource');

$.each(ds.data(), function (i, item) {
    var itemProperty = item.Property;
    // ...
});

您需要确保首先从服务中全部加载了数据,否则数据可能会返回一个空数组.

You'll need to make sure that the data is all loaded from the service first though or data will possibly return an empty array.

这篇关于如何在基础设施igniteui网格中选择单列数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆