Ext.Toolbar上的combo控件及其文本标签text同时隐藏/显示...

1. Toolbar上的combo控件及其文本标签text同时隐藏/显示:

state = url.slice(1,2);

tbar = new Ext.Toolbar([

            {
                text: "状态"
                ,hidden: (state!=='6')
            }
            ,{
                xtype: 'combo'
                ,hidden: (state!=='6')
                ,name: 'submitState',
              id: 'id_SubmitState',
              triggerAction: 'all',
        forceSelection :true,
        lazyInit :false,
        editable :false,
              width: 89,
        store: new Ext.data.SimpleStore({
                    fields: ["retrunValue", "displayText"],
                        data: [['', '请选择'], ['2', '合格'], ['3', '不合格'], ['01', '未检查']]
            }),
        mode: 'local',
        valueField: "retrunValue",
        displayField: "displayText",
        emptyText :'请选择',
        listeners: {
            select: function(){
                try {
                    t_serachType = 'simp';
                            searchInfo();
                } catch(ex) {
                    Ext.MessageBox.alert(ex);
                }
                }
        },
              anchor: '99%'
            }
]);

 

2. 隐藏 Ext.form.DateField 的触发(trigger)元素并使其所有的文本框(text field)显示格式为Y-m-d(2009-06-18):

2.1 隐藏 Ext.form.DateField 的触发(trigger)元素

items : [{
            xtype : 'datefield ',
            fieldLabel : '开始日期',
            name : 'fillinDate',
            id : 'fillinDate',
            format: 'Y-m-d ',
            hideTrigger: true, // True to hide the trigger element and display only the base text field(defaults to false)
            readOnly: true ,
            anchor : '95%'
               }]

2.2 使 DateField 所有的文本框(text field)显示格式为Y-m-d(2009-06-18),只要在 js 文件的开头加以下代码即可:

Ext.apply(Ext.form.DateField.prototype, {
    altFormats :'Y-m-dTH:i:s',
    format :'Y-m-d'
});

 

 

3. 在 Grid 中显示日期:

var sm = new Ext.grid.CheckboxSelectionModel({singleSelect: true});
var colM = new Ext.grid.ColumnModel([
    new Ext.grid.RowNumberer(), sm,

{header :'开始日期', width :100, sortable :true, renderer: Ext.util.Format.dateRenderer('Y-m-d'), dataIndex :'fillinDate'}

]);

 

var store = new Ext.data.JsonStore({
    url :'../contractIn/viewContractByYearCheckState.action?state=' + state,
    storeId :'ds',
    root :'contracts',
    totalProperty: 'recordCount',

    fields : [{name :'fillinDate', type :'date', dateFormat :'Y-m-dTH:i:s'}]

});

 

4. 如何获得 URl 所携带的参数?

可以利用 location.search 获得 URL 的参数。如不能可以在 location 前面加上 window,即 window.location.search

var url = location.search; // 如果 URL:http://localhost:8080/WebFrame.jsp?0&officeCode,则 url = ?0&officeCode

JS 数组的 slice 方法类似 java String 的 subString 方法。

var state = url.slice(1,2);     // 表示从数组 url 中去 index 为1的子字符串,state = 0

var userType = url.slice(3);  // 表示从数组 url index 为3开始直到末尾的子字符串,userType = officeCode

可以查 Javascript 的 API

 

5. Extjs中动态的改变TextFiled的emptyText:

    function searchByEmCode() {
    var tf = Ext.getCmp("text_Search");
    //下面两行用来设置默认值
       tf.emptyText = 'searchByEmCode';
       tf.setRawValue(tf.emptyText);
       tf.show();
    }

 

版权声明:

如果大家要转载本文,我非常荣幸。但请参加转载网址,谢谢!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值