Hi,
Here is my "_IgniteRazorPivotTablePartial" View which is using IEnumerable<ModelName> model:
@using Infragistics.Web.Mvc@model IEnumerable<ModelName>
<!DOCTYPE html>
<html><head> <title></title>
<!-- Ignite UI Required Combined CSS Files --> <link href="http://cdn-na.infragistics.com/igniteui/2014.2/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" /> <link href="http://cdn-na.infragistics.com/igniteui/2014.2/latest/css/structure/infragistics.css" rel="stylesheet" />
<script src="http://modernizr.com/downloads/modernizr-latest.js"></script> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
<!-- Ignite UI Required Combined JavaScript Files --> <script src="http://cdn-na.infragistics.com/igniteui/2014.2/latest/js/infragistics.core.js"></script> <script src="http://cdn-na.infragistics.com/igniteui/2014.2/latest/js/infragistics.lob.js"></script></head><body>@(Html.Infragistics().PivotGrid() .Width("915") .Height("600") .DataSourceOptions( dataSourceOptions => dataSourceOptions .Columns("[Location].[Location]") .Rows("[Dates].[RequiredDate]") .Measures("[Measures].[Freight]") .FlatDataOptions(flatOptions => flatOptions.Metadata( metadata => metadata.Cube(cube => cube.Name("Invoices").Caption("Invoices") .MeasuresDimension(measuresDimension => measuresDimension.Caption("Measures").Measures( measures => { measures.AddMeasure().Name("Customers").Caption("Customers Count").Aggregator("$.ig.OlapUtilities.prototype.sumCount('Customers')"); })) .Dimensions(dimensions => { dimensions.AddDimension().Name("Customers").Caption("Customers").Hierarchies( hierarchies => hierarchies.AddHierarchy().Name("Customers").Caption("Customers").Levels(levels => { levels.AddLevel().Name("AllCustomers").Caption("All Customers") .MemberProvider("function(item) {return 'All Customers'; }"); levels.AddLevel().Name("CustomerName").Caption("Customer Name") .MemberProvider("function(item) {return item.CustomerName; }"); })); dimensions.AddDimension().Name("Products").Caption("Products").Hierarchies( hierarchies => hierarchies.AddHierarchy().Name("Products").Caption("Products").Levels(levels => { levels.AddLevel().Name("AllProducts").Caption("All Products") .MemberProvider("function(item) {return 'All Products'; }"); levels.AddLevel().Name("Product").Caption("Product") .MemberProvider("function(item) {return item.ProductName; }"); })); }))) .DataSource(Model) .DataBind())).ID("pivotGrid") .Render())
</body></html>
and here is my model:
public class ModelName{ public string CustomerName { get; set; } public string ProductName { get; set; }
}
And Controller:
public ActionResult ViewRazorIgnitePivotTable(string sessionId){ try { var ModelNameInstance = new List<ModelName>(); var fileName = Server.MapPath(@"~/sample.csv");
ModelNameInstance.AddRange(System.IO.File.ReadAllLines(fileName) .Skip(1) .Select(c => c.Split(',')) .Select(c => new ModelName { CustomerName = c[0].ToString(), ProductName = c[1].ToString(), }).ToList());
return PartialView("_IgniteRazorPivotTablePartial", ModelNameInstance); } catch (Exception ex) { throw ex; }}
My partial view, receives the right model (which I doubt is accepted by your Pivot Grid) so is not able to recognise neither item.ProductName nor item.CustomerName and throws an error which is unable to get value for null/undefined reference.
I appreciate if you could give me an idea of what could be the problem.
Thanks in advance,
Hello,
I am currently working onto this issue and will update you with my findings.
I just wanted to inform you that I am still working to figure this out. I will try to reproduce the same error end provide a solution or send a working sample that will help identifying the issue nature.
Thank you for your patience.
I was not able to reproduce this issue without the .csv file you use to load data from, so it will be highly appreciated if you could provide it or just a part of it to use as junk data. In the meantime I believe you will find this resource helpful:
http://www.igniteui.com/help/igolapflatdatasource-adding-using-mvc-helper
http://www.igniteui.com/pivot-grid/using-the-asp-net-mvc-helper-with-flat-data-source
Looking forward to hearing from you.
I'm just following up to see if you had the time to provide the .csv file that your code uses or if you had managed to resolve your issue.
I'm just following up to see if you need any further assistance with this issue. If so please let me know.