Chinaunix首页 | 论坛 | 博客
  • 博客访问: 30465439
  • 博文数量: 708
  • 博客积分: 12163
  • 博客等级: 上将
  • 技术积分: 8240
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-04 20:59
文章分类

全部博文(708)

分类: Java

2009-11-03 14:29:01

遇到ext groupRenderer为空或不是对象问题
 
 

        var milestoneListProxy = new Ext.data.HttpProxy( {
            method :"POST",
            url : 'data.jsp'
        });

        var milestoneListReader = new Ext.data.JsonReader({

            fields : [ 'projectId', 
                       'milestoneId', 
                       'milestoneName', 
                       'date', 
                       'sectionId', 
                       'sectionName', 
                       'planTotalCost', 
                       'planCompleteCost', 
                       'planCompleteRate', 
                       'realityCompleteCost', 
                       'realityCompleteRate' 
                       ],
            root : 'root'
        });

        var milestoneListStore = new Ext.data.GroupingStore({
            proxy :milestoneListProxy,
            reader :milestoneListReader,
            sortInfo:{field: 'projectId', direction: "ASC"},
            groupField:'milestoneName' // ①
        });

// ②
        var milestoneListColumns = [ new Ext.grid.RowNumberer(), {
            header :"マイルストーン",
            dataIndex :'milestoneName'
          }, {
            header :"日付",
            dataIndex :'date'
          }, {
            header :"作業名",
            dataIndex :'sectionName'
          }, {
            header :"計画完成工数",
            dataIndex :'planCompleteCost'
          }, {
            header :"実際完成工数",
            dataIndex :'realityCompleteCost'
          }, {
            header :"実際達成度",
            dataIndex :'realityCompleteRate'
          } ];

        var onAdd = function() {
            milestonePanel.show();
            Ext.getCmp('date').setValue('');
            Ext.getCmp('milestoneName').setValue('');
            Ext.getCmp('description').setValue('');
            milestoneForm.isAdd = true;
        };

        var onDelete = function() {
            var rec = milestoneListGrid.getSelectionModel().getSelected();
            if (!rec) {
                Ext.MessageBox.alert('警告', '選択してください。');
                return false;
              }
            Ext.Msg.show({
                title:'確認',
                msg: '削除確認?',
                buttons: Ext.Msg.YESNOCANCEL,
// fn: function() {alert();},

                icon: Ext.MessageBox.QUESTION
             });
        };

        var milestoneListGrid = new Ext.grid.GridPanel( {
            restful : true,
            iconCls :'icon-grid',
            frame :true,
            autoScroll :true,
            autoHeight :true,
            animCollapse: false,
            sm :new Ext.grid.RowSelectionModel( {
              singleSelect :true
            }),
            store :milestoneListStore,
            columns :milestoneListColumns,
            loadMask : {
              msg :'Loading.....'
            },
            bbar :new Ext.PagingToolbar( {
  // id :'milestoneListBbar',

              pageSize :10,
              store :milestoneListStore,
              displayInfo :true
            }),
            tbar : [ {
                text :'追加',
                handler : onAdd
              }, '-', {
                text :'削除',
                handler : onDelete
              }],

              view: new Ext.grid.GroupingView({
                  forceFit:true,
                  groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
              }),

              listeners : {
                'rowdblclick' : function() {
                              milestonePanel.show();
                              var rec = milestoneListGrid.getSelectionModel().getSelected();
                              Ext.getCmp('date').setValue(rec.get('date'));
                              Ext.getCmp('milestoneName').setValue(rec.get('milestoneName'));
                              Ext.getCmp('description').setValue(rec.get('milestoneName'));
                              milestoneForm.isAdd = false;
                          }
              }
        });


如果①处分组的字段在②中没有,就会提示【groupRenderer为空或不是对象】错误!
阅读(2312) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-08-01 11:28:08

ee