请教一个有关jquery插件Flexigrid的问题
$('#flexigridtable').flexigrid({
url: 'GetFlexigridData.ashx',
dataType: 'json',
colModel : [
{ display: 'productId', name: 'productId', width: 60, sortable: true, align: 'center' },
{ display: 'productlistName', name: 'productName', width: 60, sortable: true, align: 'center' },
{ display: 'specification', name: 'specification', width: 140, sortable: true, align: 'left' },
{ display: 'merchantCode', name: 'merchantCode', width: 120, sortable: true, align: 'left' },
{ display: 'sellingStore', name: 'sellingStore', width: 130, sortable: true, align: 'left', hide: false },
{ display: 'priceRange', name: 'priceRange', width: 80, sortable: true, align: 'right' },
{ display: 'repertory', name: 'repertory', width: 80, sortable: true, align: 'right' },
{ display: 'updateTime', name: 'updateTime', width: 80, sortable: true, align: 'right' }
]
});上面是我的js代码。
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
DataModelDataContext db = new DataModelDataContext();
List<Products> list = db.Products.ToList();
string jsonStr = JsonConvert.SerializeObject(list);
context.Response.Write(jsonStr);
}
上面是我的后台取数据代码,是asp.net的一般处理程序,返回的数据是json字符串,如下:
[{"productId":1,"productName":"ipad","specification":"黑色 8G","merchantCode":"Y001201","sellingStore":"淘宝一电(80)","priceRange":"4000~5000","repertory":80,"updateTime":"2013-06-21T17:06:39.547"},
{"productId":2,"productName":"iphone","specification":"黑色 8G","merchantCode":"Y101201","sellingStore":"拍拍一店(60)","priceRange":"3500~4000","repertory":80,"updateTime":"2013-06-21T17:07:46.913"},
{"productId":3,"productName":"ipad","specification":"黑色 8G","merchantCode":"Y001201","sellingStore":"淘宝一电(80)","priceRange":"4000~5000","repertory":80,"updateTime":"2013-06-21T17:06:39.547"}]
我的问题是为什么前台不显示我的数据内容:
只有一个表头,是不是我的数据格式不对? flexigrid
[解决办法]
http://blog.csdn.net/cuishaofeng/article/details/6311427