weixin_33717117 2015-10-01 14:52 采纳率: 0%
浏览 30

网格不显示任何数据

 var store = new Ext.data.JsonStore({
                root:           'details',
                fields: ['a1','a2','a3','a4','a5','a6','a7'],
                pruneModifiedRecords:true,
                autoload:       false
         });


         var gridDetail = new Ext.grid.Panel({
             title: 'Details',
             store: store,
             width : '100%',
             header: {
               titleAlign: 'center'
             },
             columns: [
                    { text: 'col1',  dataIndex: 'a1' },
                    { text: 'col2', dataIndex: 'a2'},
                    { text: 'col3', dataIndex: 'a3' },
                    { text: 'col4', dataIndex: 'a4' },
                    { text: 'col5', dataIndex: 'a5' },
                    { text: 'col6', dataIndex: 'a6' },
                    { text: 'col7', dataIndex: 'a7' },

                ],               
         }); 

These are my configures about store and grid. I load the data via an ajax request;

var getInfo= function (s1,s2,s3){
            gridDetail.mask('Loading'); 
             Ext.Ajax.request({                  
               url : '../project/getInfo.ajax',
               params :{
                   s1: s1,
                   s2: s2,
                   s3: s3
               },
               callback: function(options, success, response){

                        if(success){
                         var resp = Ext.decode(response.responseText);
                            gridDetail.unmask();

//some other codes not related grid

                            store.loadData(resp,false);
                        } else {
                            gridDetail.unmask();
                            Alert(resp.msj);
                        }
                 }

           });

and my return JSON is ;

{"success":true,"first":[{...},],"details":[{"a1":"d1","a2":"d2",..."a7":"d7"}]}

But after all this nothing shown on grid, and no error returns. Everything is okay but nothing happen in grid. Mask shown and then unshown but no data shown on grid.

What is my problem, i can't see it? Can anybody help me?

  • 写回答

1条回答 默认 最新

  • weixin_33743248 2015-10-01 18:31
    关注

    Seems good for me. Maybe something with the data format.

    Add a listeners to your store to check what kind of records the store get.

    listeners:{
         load: function( this, records, options ) {
            console.log(records);
         }
    }
    
    评论

报告相同问题?