Extjs 笔记

获取表单中元素值:

1.Ext.getCmp("elementId").getValue();  //通过元素id获取

2.staff_form.getForm().findField('departmentId').getValue();       //staff_form为formPanel对象名

3.Ext.get('start_date').dom.value;                          //获取日期值 start_date为日期组件id

清空表单中的值
staff_form.getForm().getEl().dom.reset();          //staff_form为formPanel对象名

 //清除验证
 addStaff_form.getForm().clearInvalid();
  //基本信息面板展开
  panelone_insertStaff.expand();
  //工作信息面板收缩
   paneltwo_insertStaff.collapse();

 //获取选中的行对象
    var staffValue = grid_staff.getSelectionModel().getSelected();

//设置员工编号的值
  addStaff_form.getForm().findField('employeeId').setValue(staffValue.data.employeeId);

 

/**
  * 创建表格列
  * @param {Object} btn
  */
 var cm_staff = new Ext.grid.ColumnModel([
  //显示行号
  new Ext.grid.RowNumberer(),
  //header头部显示的名称
  {header:'员工编号',menuDisabled:true,sortable: true,align: 'center',dataIndex:'employeeId',width:50,renderer: function (value, metadata, record) { metadata.attr = 'style="text-align:left;"'; return Ext.util.Format.htmlEncode(value);}},
  //dataIndex:要绑定的store对应Record字段名
  {header:'员工姓名',menuDisabled:true,sortable: true,align: 'center',dataIndex:'name',width:50,renderer: function (value, metadata, record) { metadata.attr = 'style="text-align:left;"'; return Ext.util.Format.htmlEncode(value);}},
  {header:'性别',menuDisabled:true,sortable: true,align: 'center',dataIndex:'sex',width:50},
  {header:'职务',menuDisabled:true,sortable: true,align: 'center',dataIndex:'dutyName',width:50,renderer: function (value, metadata, record) { metadata.attr = 'style="text-align:left;"'; return Ext.util.Format.htmlEncode(value);}},
  {header:'入职时间',menuDisabled:true,sortable: true,align: 'center',dataIndex:'entranceDate',width:50},
  {header:'合同开始时间',menuDisabled:true,sortable: true,align: 'center',dataIndex:'agreementStartDate',width:50},
  {header:'毕业时间',menuDisabled:true,sortable: true,align: 'center',dataIndex:'graduationDate',width:50},
  {header:'联系电话',menuDisabled:true,sortable: true,align: 'center',dataIndex:'mobile',width:50,renderer: function (value, metadata, record) { metadata.attr = 'style="text-align:left;"'; return Ext.util.Format.htmlEncode(value);}},
  {header:'工作流',menuDisabled:true,sortable: true,align: 'center',dataIndex:'workFlowFlag',width:50,
   renderer:function(value,cellmeta,record,rowIndex,
     columnIndex,store){
    //未确认时
    if(value == 0)
    {
     return '<span style="color:red;">未设置</span>'
    }else if(value == 1){
     return "已设置"
    }
  }
  },
   {header:'部门',align: 'center',dataIndex:'departmentId',width:50,hidden:true},
   ]);

 

 /**
    * 数据源加载前载入检索表单条件
    * 翻页保留搜索条件了
    */
   store_staff.on('beforeload',function(){
         Ext.apply(
         this.baseParams,
         {
          departmentId:Ext.getCmp('departmentId_staff').getValue(),
       dutyId:Ext.getCmp('dutyId_staff').getValue(),
       stateId:Ext.getCmp('stateId_staff').getValue(),
          workFlowFlag:Ext.getCmp('workFlowFlag_staff').getValue(),
       kind:Ext.getCmp('kind_staff').getValue(),
       name:Ext.getCmp('name_staff').getValue(),
       start:0,
       limit:30
         });
      });

//数据源加载

store_obj.load({

          params : {
                  employeeId:personId_personRecord
                  },

           callback : function(){                                    //callback 为回调函数

                      alert("数据源加载完执行该函数");

           }

})

你可能感兴趣的:(工作,Date,function,header,ExtJs,callback)