Hi,
I am having issues with the autogeneratecolumns feature of igGrid.
I am given the task of making a generic grid which could render the data of a dynamic datasource provided to it at runtime.
I am using Asp.Net MVC. I have a view named Listing.cshtml which will get an action method and cotroller name in its ViewBag and render the grid with datasourceurl set as the ViewBag.ActionMethod & ViewBag,ControllerName supplied to it.
This means that the grid will be displaying dynamic data and its datasource will change dynamically, because GridDataSource action name will be passed as a parameter.
When I set autogeneratecolumns(true) my grid does not render the rows and instead shows a loading circle animation which keeps on loading. I was just checking to see if my grid would render the columns automatically or not, because if I specify the columns explicitly the grid renders fine. When i set autogeneratecolumns to true, the grid does not display data.
Why is that happening? Please guide me i am stuck here. How can I render the grid dynamically without knowing the columns of the datasource through Asp.Net MVC helper.
Also is this achievable that I have a single .cshtml page for my grid and at runtime the page is supplied with the DataSourceUrl, and after reading it from the ViewBag , The grid loads its datasource at runtime. Is this possible? If it is then what would I provide inside the @(Html.Infragistics().Grid<????>() ??
And would the grid render without specifying the @model directive on top of page because the model will change at runtime.
Please help me out here , and if possible please provide a working sample in which the grid datasource is loaded dynamically and its datasource is set to a string which contains the name of [GridDataSourceAction].
Also why my grid is no displaying data when i set autogeneratecolumns to true and renders fine when I explicitly specify the columns.
Any help would be appreciated.
AutoGenerateColumns(true) does not work when I am using MVC helper , then i tried the Jquery way but in MVC Helper method the grid automatically supplied the pagesize & pageIndex parameters to my method through querystring but here because i am makin an ajax call to get json data and the grid is not initialized , the page size & pageIndex variable are null and this results in exception.
Please tell me a way through which I can use a single grid for various datasources(dynamically changing at runtime) and ASP.Net MVC Helper/Controller method will be great because I dont want to initialize the grid and supply the datasource through Jquery for some reasons.
QUESTION:Why is my autoGenerateColumns(true) not working when I use ASP.Net MVC Helper, the grid just shows the loading circle animation.
QUESTION:If the grid will be supplied with dynamic datasource, what will I write in place of @model directive & @(Html.Infragistics().Grid<????>() ?????
This is the Jquery way through which i tried loading the grid but it does not get the page size & pageIndex parameters. I am using Remote pagination. These two parameters were automatically supplied to the grid when i used ASP.Net MVC Helper.
<table id="grid"></table><script> $(function () { $.ajax({ type : "GET", dataType : "json", url : "/Users/GetUsers", success: function (data) { $("#grid").igGrid({ autoGenerateColumns: true, defaultColumnWidth: "150px", width: "100%", dataSource: data, responseDataKey: "Records", features: [ { name: "Paging", type: "local", }, { name: "Sorting", type: "local" }, { name: "Filtering", type: "local" } ] }); console.log(data); } }); }); </script>