infragistics.Web.Mvc 使用(读取后台返回的数据)
来源:互联网 发布:winpe工具箱代网络 编辑:程序博客网 时间:2024/05/21 16:55
infragistics.Web.Mvc 使用(读取后台返回的数据) 提供Flat Table的OLAP表格
//相关资源 http://download.csdn.net/detail/lglgsy456/5609013
//前台
<html>
<head>
<!-- Infragistics Combined CSS -->
<link href="~/Content/infra/themes/infragistics/infragistics.theme.css" rel="stylesheet" type="text/css" />
<link href="~/Content/infra/structure/infragistics.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="~/Scripts/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="~/Scripts/jquery-ui-1.10.0.min.js"></script>
<!-- jQuery Core and jQ UI -->
<script src="~/Scripts/infra/infragistics.core.js" type="text/javascript"></script>
<script src="~/Scripts/infra/infragistics.lob.js" type="text/javascript"></script>
<body>
<div id="pivotView"></div>
</body>
<script type="text/javascript">
var dataArray = [];
var url = "@Url.Action("ReportsData")";
$.ajax({
url: url,
async:false,
type: "POST",
dataType: "json",
error: function () {
},
success: function (data) {
dataArray = data;
}
});
var data = dataArray;
//[{ "ProductCategory": "Clothing", "UnitPrice": 12.81, "SellerName": "Stanley Brooker", "Country": "Bulgaria", "City": "Plovdiv", "Date": "01/01/2012", "UnitsSold": 282 },
//{ "ProductCategory": "Clothing", "UnitPrice": 49.57, "SellerName": "Elisa Longbottom", "Country": "US", "City": "New York", "Date": "01/05/2013", "UnitsSold": 296 },
//{ "ProductCategory": "Bikes", "UnitPrice": 3.56, "SellerName": "Lydia Burson", "Country": "Uruguay", "City": "Ciudad de la Costa", "Date": "01/06/2011", "UnitsSold": 68 },
//{ "ProductCategory": "Accessories", "UnitPrice": 85.58, "SellerName": "David Haley", "Country": "UK", "City": "London", "Date": "04/07/2012", "UnitsSold": 293 },
//{ "ProductCategory": "Components", "UnitPrice": 18.13, "SellerName": "John Smith", "Country": "Japan", "City": "Yokohama", "Date": "12/08/2012", "UnitsSold": 240 },
//{ "ProductCategory": "Clothing", "UnitPrice": 68.33, "SellerName": "Larry Lieb", "Country": "Uruguay", "City": "Ciudad de la Costa", "Date": "05/12/2011", "UnitsSold": 456 },
//{ "ProductCategory": "Components", "UnitPrice": 16.05, "SellerName": "Walter Pang", "Country": "Bulgaria", "City": "Sofia", "Date": "02/19/2013", "UnitsSold": 492 }];
$(function () {
// create the OlapFlatDataSource instance
var dataSource = new $.ig.OlapFlatDataSource({
dataSource: data,
metadata: {
cube: {
name: "Sales",
caption: "Sales",
measuresDimension: {
caption: "Measures",
measures: [ //for each measure, name and aggregator are required
{
caption: "Units Sold", name: "UnitsSold",
// returns a function that will be used as sum aggregatro on the 'UnitsSold property' of the data objects
aggregator: $.ig.OlapUtilities.prototype.sumAggregator('UnitsSold')
}]
},
dimensions: [ // for each dimension name and hierarchies are required
{
caption: "Seller", name: "Seller", hierarchies: [{
caption: "Seller", name: "Seller", levels: [
{
name: "AllSellers", caption: "All Sellers",
memberProvider: function (item) { return "All Sellers"; }
},
{
name: "SellerName", caption: "Seller",
memberProvider: function (item) { return item.SellerName; }
}]
}]
},
{
caption: "Date", name: "Date", /*displayFolder: "Folder1\\Folder2",*/hierarchies: [
$.ig.OlapUtilities.prototype.getDateHierarchy(
"Date", // the source property name
["year", "quarter", "month", "date"], // the date parts for which levels will be generated (optional)
"Dates", // The name for the hierarchy (optional)
"Date", // The caption for the hierarchy (optional)
["Year", "Quarter", "Month", "Day"], // the captions for the levels (optional)
"All Periods") // the root level caption (optional)
]
}
]
}
},
// Preload hiearhies for the rows, columns, filters and measures
rows: "[Date].[Dates]",
columns: "[Seller].[Seller]",
measures: "[Measures].[UnitsSold]"
});
$('#pivotView').igPivotView({
dataSource: dataSource
});
});
</script>
</html>
//后台
public ActionResult Reports()
{
return View();
}
[HttpPost]
public JsonResult ReportsData()
{
var model = new List<object>();
model.Add(new { ProductCategory = "Clothing", UnitPrice = 12.81, SellerName = "Stanley Brooker1", Country = "Bulgaria", City = "Plovdiv", Date = "01/01/2012", UnitsSold = 282 });
model.Add(new { ProductCategory = "Bikes", UnitPrice = 49.57, SellerName = "Elisa Longbottom", Country = "US", City = "New York", Date = "01/01/2012", UnitsSold = 208 });
model.Add(new { ProductCategory = "Clothing", UnitPrice = 12.81, SellerName = "Stanley Brooker2", Country = "Bulgaria", City = "Plovdiv", Date = "01/01/2012", UnitsSold = 2832 });
model.Add(new { ProductCategory = "Clothing", UnitPrice = 12.81, SellerName = "Stanley Brooker3", Country = "Bulgaria", City = "Plovdiv", Date = "01/01/2012", UnitsSold = 2812 });
return Json(model);
}
- infragistics.Web.Mvc 使用(读取后台返回的数据)
- web下的Infragistics
- 使用spring mvc前台获取后台返回的List
- 在ASP.NET MVC中json的应用(即JsonResult)(asp.net mvc 后台返回json数据方式 )
- Infragistics WebDataGrid的使用
- 01.j2ee写后台返回数据&ios的tableView使用
- ExtJs读取后台的数据
- spring mvc 从页面请求到 经过后台返回 数据页面的过程
- Infragistics NetAdvantage UltraGrid的使用
- Infragistics NetAdvantage UltraGrid的使用
- 使用spring MVC返回json格式的数据
- jquery结合Spring MVC实现从后台读取数据的输入框提示
- 后台返回一个string类型的json格式数据,前台js如何读取?
- Spring MVC后台返回JSON数据中文乱码问题解决
- UltraTree的使用(Infragistics.Win.UltraWinTree.UltraTree)
- 读取URL返回的数据
- Infragistics web tree的应用(例子一)
- MVC项目中与后台协调写出的关于表格数据读取、修改、删除、提交、新增数据的JS事件
- 判断单链表是否有环
- Java,Oracle,MySQL数据设计数据类型参考
- 电磁辐射对人无害,电离辐射才对人有害
- StringUtils中 isNotEmpty 和isNotBlank的区别
- 单链表的逆置(C++版)
- infragistics.Web.Mvc 使用(读取后台返回的数据)
- oracle存储过程与游标的使用
- iOS开源项目GitHub移动开发最受欢迎的开源项目
- 单例模式
- (Extjs)对于GridPanel的各种操作
- jdk与jre的区别
- 常用25个算法
- Best Way to Refresh Adapter/ListView on Android
- 关于时区 待续