I am trying to populate a grid with data from a web servive method call. I'm getting the data returned in the correct format and the grid loads with no data displayed. I can see that I am getting 190 records returned from the call. Can you see anything wrong below?
$.ig.loader({
scriptPath: "../../js/",
cssPath: "../../css/",
resources: "igGrid.Paging,igGrid.Sorting,igGrid.Filtering"
});
var CabinetList;
$(document).ready(
function () {
GetCabinets();
var url = "../../../../Inventory.asmx/getCabinets3";
var dataParams = '';
function GetCabinets() {
$.ajax({
type: "POST",
url: url,
async: false,
data: '{' + dataParams + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
CabinetList = { "Records": [data.d] };
//alert([data.d]);
//document.write(data.d);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.responseText);
alert(thrownError);
}
$.ig.loader( function () {
$(function () {
$("#grid1").igGrid({
columns: [{
headerText: "Cabinet ID",
key: "cabinetid",
dataType: "string"
{
headerText: "Title",
key: title",
}],
features: [
name: 'Paging',
pageSize: 20
name: 'Sorting'
name: 'Filtering',
filterDropDownItemIcons: false,
filterDropDownWidth: 200
],
autoGenerateColumns: false,
dataSource: CabinetList.Records,
height: 300
Hi JsonTerre
I'm doing the same thing, if you add the grid initialisation to your success call the grid should populate with your records correctly.
records = data.d;
//add a check to see if the grid data is not yet setup
if($("#grid1").data("igGrid") === undefined) {
dataSource: records,
columns etc...
Let me know if this helps.
Wayne
Now I have the following and i get a error saying that igGrid is undefined:
//CabinetList = { "Records": [data.d] };
dataSource: data.d,
I'm trying to implement paging, search options, filters, sorting and so on with a loader. Do i disregaurd the following section and move the initialization or have both. Sorry this is my first time every using any of these controls. Very green...
$.ig.loader(
$(
"#grid1").igGrid({