$('#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

解决方案 »

  1.   

    <table id="flexigridtable"></table>
      

  2.   

    谢谢,这个我已经写上了,现在怀疑是数据问题,flexigrid需要的数据是不是json字符串
      

  3.   

    http://blog.csdn.net/cuishaofeng/article/details/6311427
      

  4.   

    问题解决了,原来是后台拼接json数据的时候要对引号进行转义,前端没有问题
    sbu.Append("{\"pid\":" + item.productId + ",\"cell\":[\"" + item.productId + "\",\"" + item.productName + "\",\"" + item.specification + "\",\"" + item.merchantCode + "\",\"" + item.sellingStore + "\"");
                    sbu.Append(",\"" + item.priceRange + "\",\"" + item.repertory + "\",\"" + item.updateTime + "\"]},");
    现在有一个新问题,就是我的数据在FF chrome oprea 360等浏览器正常显示数据,但是IE的各个版本都不显示
    FF chrome oprea 360等浏览器:
    在IE下:
    有知道处理方法的朋友吗?谢谢
      

  5.   

    问题已经解决:网上的答案经我验证都是不靠谱的,以后大家就知道了,Flexigrid在IE下不显示数据的处理方法是:指定一下Ajax请求数据的方式为Get方式