双击gridpanel 行 打开一个formpanel ,在formpanel 中有一个gridpanel。后台返回了json
{totalPorperty:1,root:[{"id":"1","task_no":"N001","task_name":"1","task_work":"1","task_need":"1","start_date":"2011-5-3 0:00:00","end_date":"2011-5-6 0:00:00","task_statu":"完成"}]}代码:grid.on('rowdblclick', function ( grid, rowIndex, e) {  
                                           var selectionModel = grid.getSelectionModel();    
                                           var record = selectionModel.getSelected();      
                                           var flag=record.data['task_no'];
                                           alert(flag);
                                           handler:{ 
                                              detailPanel.show();
                                  logstore.load({
                                         params: {start: 0, limit: 10,"task_no":flag}
                                        })
                                            }
                                          });   
             

var task_person=new Ext.form.TextField({
id:'task_person',
name:'task_person',
width:80 });

var task_no=new Ext.form.TextField({
id:'task_no',
name:'task_no',
width:80 });


var query1=new Ext.Button({
text:'查询',
icon:'./Images/icons/search.gif',
listeners:{scope:this,
            "click":function(){
             //任务编号
             task_no=Ext.getCmp("task_no").getValue();
            
             //任务执行人
             task_person=Ext.getCmp("task_person").getValue(); //store.proxy=new Ext.data.HttpProxy({url:url});
logstore.reload({
                               params:{start: 0, 
                                       limit: 10,
                                       'task_no':task_no,
                                       'task_person':task_person
                                    }
                               })
            }
            }
});





    var toolBar2 = new Ext.Toolbar({ 
             items: 
              [         
'任务执行人:',
task_person,
{xtype: 'tbspacer',width:this.spaceWidth},
'任务编号:',
task_no,
{xtype: 'tbspacer',width:this.spaceWidth},
    query1,
    {xtype: 'tbspacer',width:this.spaceWidth}
   
             ]}); 
   
       //任务开始日期----------
       var start_date = new Ext.form.DateField({
         id:'startdate',
         name : "startdate",
         fieldLabel : "开始时间",
         allowBlank:false, 
         width : 132,
         format : "Y-m-d"//指定日期格式,Y 表示四位数的年,m表示月,d表示日        //默认为当前日期
        });
        //任务结束日期----------
         var end_date = new Ext.form.DateField({
         id:'enddate',
         name : "enddate",
         allowBlank:false, 
         fieldLabel : "结束时间",
         width : 132,
         format : "Y-m-d"//指定日期格式,Y 表示四位数的年,m表示月,d表示日        //默认为当前日期
        });           

 var colModel = new Ext.grid.ColumnModel([
        {header: "任务名称",  sortable: true,  dataIndex: 'task_name'},
        {header: "细节描述",  sortable: true,  dataIndex: 'task_re'},
        {header: "工作任务",  sortable: true,  dataIndex: 'task_work'},
        {header: "任务需时",  sortable: true,  dataIndex: 'task_need'},
        {header: "开始时间",  sortable: true,  dataIndex: 'start_date'},
        {header: "结束时间",  sortable: true,  dataIndex: 'end_date'},
        {header: "执行状态",  sortable: true,  dataIndex: 'task_statu'}
     ]);
    
    
  var logstore = new Ext.data.JsonStore({
  proxy :new Ext.data.HttpProxy( {
//method :'get',get模式下提交不了页面的参数
method:'post',
url :'ExecutionWorkTaskdetail.aspx'
}),
root :'root',
          totalProperty :'totalPorperty',
         idProperty: 'threadid',
        remoteSort: true,
 fields:
  [
    {name:"task_name" , type:"int"},
    {name:"task_name" , type:"int"},
    {name:"task_need" , type:"string"} ,
    {name:"start_date" ,type:"string"},
    {name:"end_date" ,  type:"string"},
    {name:"task_statu" ,type:"string"}
 ]
});


   var date1=[['完成','完成'],['未完成','未完成']];
    var gridForm = new Ext.FormPanel({
        frame: true,
        labelAlign: 'left',
        title: '任务执行日志',
        bodyStyle:'padding:5px',
        width: 900,
        height :485,
        layout: 'column',    // Specifies that the items will now be arranged in columns
        items: [{
               columnWidth: 0.68,
               layout: 'fit',
               items: {
                  xtype: 'grid',
                  autoScroll: true, 
  trackMouseOver :false,
  loadMask : {
msg :'正在加载数据,请稍后.....'
  },
  viewConfig:
                 {
                  columnsText: '列',
                  sortAscText: '升序',
                  sortDescText: '降序',
                  forceFit:true
                 },
                  height :415,
                  ds: logstore,
                  cm: colModel,
                  tbar:toolBar2  
                 }
        
        },{
           
            columnWidth: 0.32,
            items:[
                {
                buttonAlign:'center',
                buttons : [{
                     icon: "./Images/icons/allmanagemenu.png",
                     height:40,
                     width:80,
                     cls: "x-btn-text-icon",
     text : '结束工作任务',
     handler : function() {
     }
    },{
     height:40,
                     width:80,
                     icon: "./Images/icons/closeTabOne.gif",
                     cls: "x-btn-text-icon",
     text : '关闭',
     handler : function() {
       detailPanel.hide();
      }
    }] 
              },
              {
               xtype: 'fieldset',
               title:'任务日志',
               defaults: {width: 120, border:true},   
               defaultType: 'textfield',
               items: [{
                       fieldLabel: '任务名称',
                       name: 'task_name'
                       },{
                       xtype: 'textarea',
                       fieldLabel: "细节描述",
                       name : "task_re"
                       },{
                       xtype:'combo',
                       id:'task_statu',
                       fieldLabel: '执行状态',
                       name:'task_statu',
                       store: new Ext.data.ArrayStore({
                              fields: ['abbr', 'state'],
                              data : date1
                           }),
                       valueField:'abbr',
                       displayField:'state',
                       typeAhead: true,
                       mode: 'local',
                       triggerAction: 'all',
                       emptyText:'任务执行状态',
                       selectOnFocus:true,
                       width:120
                      },{
                      xtype: 'textarea',
                      fieldLabel: '工作任务',
                      name: 'task_work'
                      },{
                      fieldLabel: '所用时间',
                      name: 'task_need'
                      },start_date,end_date
                   ],
              buttonAlign:'center',
              buttons : [{
                     height:30,
                     width:60,
                     icon: "./Images/icons/openroomiconinfo.gif",
                     cls: "x-btn-text-icon",
                     text : '保存',
                     handler : function() {
                                      //(Ext.get("task_statu").dom.value); 
                                    alert(Ext.get("task_statu").dom.value)  
        }
                     }]
                }       
          ]}
        ]
        })
  
  
   var detailPanel = new Ext.Window({
   title :'执行工作任务',
           width:900, 
           height :490,
           closeAction: 'hide',
           modal : true,
           items :gridForm
});
     
   
});后台代码:
            String task_no = Request.Form["task_no"];
            String sql = "select * from Work_log a where a.task_no='" + task_no + "'";
            DataTable ds = SqlHelper.getTable(sql);
            int count = ds.Rows.Count;
            string json = "";
            json = "{totalPorperty:" + count + ",root:" + ChangeJson.ToJson(ds) + "}";
            Response.Write(json);

解决方案 »

  1.   


    上面错了 是这个! 还是不显示数据!
     var logstore = new Ext.data.JsonStore({
      proxy :new Ext.data.HttpProxy( {
    //method :'get',get模式下提交不了页面的参数
    method:'post',
    url :'ExecutionWorkTaskdetail.aspx'
    }),
    root :'root',
              totalProperty :'totalPorperty',
             idProperty: 'threadid',
            remoteSort: true,
     fields:
      [  
        {name:"id" , type:"int"},
        {name:"task_no" , type:"String"},
        {name:"task_name" , type:"String"},
        {name:"task_work" , type:"String"},
        {name:"task_re",type:"String"},
        {name:"task_need" , type:"string"} ,
        {name:"start_date" ,type:"string"},
        {name:"end_date" ,  type:"string"},
        {name:"task_statu" ,type:"string"}
     ]
    });
      

  2.   

    你ext 前台的root 和后台对应吗?