Bevis_ 2017-06-03 01:28 采纳率: 25%
浏览 907
已结题

.NET MVC+extjs中关于在调试时grid数据显示不出来

这些代码我在VS2013中右键浏览页面数据都是可以正常显示的,可是按F5调试的时候数据就显示不出来这是为什么呢?

后台Controller中action代码:

 public ActionResult Getinfo(){
var list = new List<UserStore>();
list.Add(new UserStore() { EmailAddress = "r.taylor@abc.com", FirstName = "Rose", LastName = "Taylor" });
list.Add(new UserStore() { EmailAddress = "r.Nguyen@abc.com", FirstName = "Russell", LastName = "Nguyen" });
return Content(JsonConvert.SerializeObject(list)); 
}

ext示例代码:

 Ext.define('UserList', {
    extend: 'Ext.data.Model',
    fields: ['firstName', 'lastName', 'emailAddress'] //you can comment these fields. It still works.  
});

var userStore = Ext.create('Ext.data.Store', {
    model: 'UserList',
    proxy: {
        type: 'ajax',
        url: 'Getinfo',
        actionMethods: {
            read: 'POST' // Store设置请求的方法,与Ajax请求有区别  
        },
        reader: {
            totalProperty: 'totalCount',
            root: 'roots'
        }
    }
});
userStore.load();
//定义分页    
var pagebar = Ext.create("Ext.toolbar.Paging", {
    store: userStore,
    displayInfo: true,
    displayMsg: "显示{0}-{1}条,共计{2}条",
    emptyMsg: "没有数据"

});

Ext.application({
    name: 'Ext6 Grid示例',
    launch: function () {
        Ext.create('Ext.grid.Panel', {
            renderTo: Ext.getBody(),
            selType: 'rowmodel',//'cellmodel',  
            plugins: [{
                ptype: 'rowediting',
                clicksToEdit: 1
            }],
            store: userStore,
            columnLines: true,
            //width: "100%",  
            //frame: true,  
            forceFit: true,
            fixed: true,
            height: 500,
            title: 'Ext6 Grid示例',

            columns: [
                 {
                     text: 'First Name',
                     width: 200,
                     dataIndex: 'FirstName',
                     editor: 'textfield'
                 },
                 {
                     text: 'Last Name',
                     width: 200,
                     dataIndex: 'LastName',
                     editor: 'textfield'
                 },
                 {
                     text: 'Email Address',
                     width: 250,
                     dataIndex: 'EmailAddress',
                     editor: {
                         xtype: 'textfield',
                         allowBlank: false
                     }
                 },
                  {
                      text: 'Birth Date',
                      width: 250,
                      dataIndex: 'birthDate',
                      editor: 'datefield'
                  }
            ],
            //分页功能  
            //bbar: pagebar,  
            //分页功能-效果同上      
            dockedItems: [{
                xtype: 'pagingtoolbar',
                store: userStore,
                dock: 'bottom',
                displayInfo: true,
            }]
        });

    }
});
  • 写回答

4条回答 默认 最新

  • Bevis_ 2017-06-03 01:38
    关注

    重点就在于我右键index.cshtml->浏览方式->选择ie的时候。整个grid数据都是能够正常加载的。按f5调试时只能显示grid而数据就死活出不来,我能肯定数据是有返回到页面的。
    因为在不用ext的情况下,我让后台直接数据直接返回在页面上,返回的数据是对的。

    评论

报告相同问题?

悬赏问题

  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 file converter 转换格式失败 报错 Error marking filters as finished,如何解决?
  • ¥15 ubuntu系统下挂载磁盘上执行./提示权限不够
  • ¥15 Arcgis相交分析无法绘制一个或多个图形
  • ¥15 关于#r语言#的问题:差异分析前数据准备,报错Error in data[, sampleName1] : subscript out of bounds请问怎么解决呀以下是全部代码:
  • ¥15 seatunnel-web使用SQL组件时候后台报错,无法找到表格
  • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)
  • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误