0 0

Ext grid显示翻页序号行偏移,添加和修改数据提交时出现TypeError: m is null30

问题1:grid中生成行序号列每次点击下一页或者上一页宽度都会缩小,最终会看不到了。

问题2:在修改和添加grid里的数据时,后台数据改动成功,但前台一直等待,firebug查看出现TypeError: m is null,错误位置在ext-all.js.

 

已经把js代码放在了附件中,如果还需要其他代码,请说一声,在此谢谢各位了。

 

下面简单的贴一下grid代码和添加修改代码。

 

 Ext.grid.PageRowNumberer = Ext.extend(Ext.grid.RowNumberer, {   
  renderer:function(value, cellmeta, record, rowIndex, columnIndex, store){  
   return (store.currentPage - 1) * store.pageSize + rowIndex + 1; 
  }      
 });
 
 
 var panel = Ext.create('Ext.grid.Panel', { 
  title: '账户信息', 
  titleAlgin:'center', 
  columnLines:true,
  selModel : new Ext.selection.CheckboxModel(),
  store: Ext.data.StoreManager.lookup('userStore'), 
  columns: [
   
   Ext.create('Ext.grid.PageRowNumberer',{ 
    header:'序号', 
    width:'130' 
   }),  //remoteSort:true,
   //{ header:'id',dataIndex:'user_id',hidden:true},     
   { header: '用户名',  dataIndex: 'user_name',sortable:true,remoteSort:true,width:200}, 
   { header: '真实姓名', dataIndex: 'true_name',sortable:true,remoteSort:true,width:200}, 
   { header: '手机', dataIndex: 'user_telephone',sortable:true,remoteSort:true,width:200},

 { xtype:"actioncolumn",header:"操作",
   items:[{  
    icon: 'Folder Settings/edit.png',          
    tooltip: 'Edit',
    handler: _edit
   }

 

修改:

 function _edit(grid,rowIndex,colIndex){//显示选择行
    var record=grid.getStore().getAt(rowIndex);    
       //var user_name=record.get("user_name");        
     
             Ext.form.Field.prototype.msgTarget = 'side';//设置提示信息位置为边上
               var window_form_edit = new Ext.FormPanel({//初始化表单面板
                id: 'window_form_edit',
                name: 'window_form_edit',
                labelWidth: 60, // 默认标签宽度板
                labelAlign: 'right',
                baseCls: 'x-plain',//不设置该值,表单将保持原样,设置后表单与窗体完全融合
                bodyStyle: 'padding:5px 5px 0',
                width: 350,
                frame: true,
                //border: false,
                defaults: {
                 width: 320,
                 height: 260
                },
                defaultType: 'textfield',//默认字段类型
                items: [{
                 xtype: 'fieldset',
                 title: '修改用户信息',
                 defaults: {
                     xtype: 'textfield',
                     width: 200
                    },
                    items: [{
                         name: 'user_name',
                         fieldLabel: '用户名',
                         allowBlank: false,
                         blankText: '用户名不能为空',
                         value: record.get("user_name"),
       vtype:'alphanum',
       vtypeText: '用户名只能是字母或数字'
                     }, {
                           name: 'user_telephone',
                           fieldLabel: '手机号码',
                           allowBlank: false,
                           blankText: '手机号码不能为空',
                           value: record.get("user_telephone")
                       },{
       name: 'true_name',
       fieldLabel: '真实姓名',
       allowBlank: false,
       blankText: '真实姓名不能为空',
       value: record.get("true_name")
      }]
                   }],
                 buttons: [{
                      text: '确定',
                      handler: function(){//添加网站
                          if (edit_widow.getComponent('window_form_edit').form.isValid()) {
                              edit_widow.getComponent('window_form_edit').form.submit({
                                  waitTitle: '请稍候',
                                  waitMsg: '正在提交数据,请稍候....',
                                  url: 'userController.php?flag=update',
                                  method: 'POST',
                                  success: function(form, action){
                                      var Result = action.result.success;
                                      if (Result == false) {
                                          Ext.MessageBox.alert('提示', action.result.message);
                                      }
                                      else
                                          if (Result == true) {
                                              Ext.MessageBox.alert('提示', action.result.message);
                                              //window_form_add.form.reset();
                                              store.loadPage(1);
                                              edit_widow.close();
                                          }
                                  },
                                  failure: function(form, action){
                                      Ext.MessageBox.alert('提示', action.result.message);
                                      window_form_edit.form.reset();
                                  }
                                 
                              })
                          }
                      }
                  }, {
                      text: '取消',
                      handler: function(){
                          window_form_edit.form.reset();
                      }
                  }]
              });
              var edit_widow = new Ext.Window({
                  title: "修改记录--" + record.get("user_name"),
                  width: 350,
                  height: 350,
                  modal: true,
                  maximizable: true,
                  items: window_form_edit
              });
              edit_widow.show();
          }

 

 

2012年8月23日 10:13
目前还没有答案

相关推荐

Global site tag (gtag.js) - Google Analytics