how to select single column data in infragistics igniteui grid

孤人 提交于 2020-01-05 10:26:16

问题


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");

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");

but not able to access one column data.


回答1:


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.



来源:https://stackoverflow.com/questions/18545057/how-to-select-single-column-data-in-infragistics-igniteui-grid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!