how access igGrid dataSource after REST bind?
New DiscussionHi,
I want use template for one igGrid column after it is filled with REST data
and somehow cannot access data loaded in the grid like below code,
dataSource = $(“#grid1”).igGrid(“option”, “dataSource”); is empty…..
$(‘#grid1’).igGrid({
requestType: “POST”,
dataSource: ‘/Home/GridGetData’,
autoGenerateLayouts: false,
autoGenerateColumns: false,
mergeUnboundColumns: false,
responseDataKey: ‘Records’,
generateCompactJSONResponse: false,
rendered: function (evt, ui) {
tmpl = “<div id=grdlist_${ProductID}></div>”;
$(‘#grid1’).igGrid(‘setColumnTemplate’, ‘Name’, tmpl);
},
columns: [
{ key: ‘ProductID’, dataType: ‘number’, headerText: ‘ID’, width: ‘116px’},
{ key: ‘Name’, dataType: ‘string’, headerText: ‘Name’, width: ‘117px’ },
{ key: ‘ListPrice’, dataType: ‘number’, headerText: ‘Price’, width: ‘117px’ },
{ key: ‘ModifiedDate’, dataType: ‘date’, headerText: ‘Date’, width: ‘116px’ }
],
features: [
{
name: ‘Paging’,
recordCountKey: ‘TotalRecordsCount’,
pageIndexUrlKey: ‘page’,
pageSizeUrlKey: ‘pageSize’,
pageSize: 10,
type: ‘remote’,
pageIndexChanging: function (evt, ui) {
var ds = $(“#grid1”).data(‘igGrid’).dataSource;
ds.settings.urlParamsEncoded = function (item, params) {
params.extraParams = {
input: “text here”
};
};
}
}],
height: ‘500px’,
width: ‘100%’,
localSchemaTransform: true
});
/////////////////////////////////////////////
//ds is empty
dataSource = $(“#grid1”).igGrid(“option”, “dataSource”);
$.each(dataSource, function (index, row) {
…………………………………….
});
});
why?
thanks