问题
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