关于手机(extjs ,touch,打包)编程的那点事情,编程,打包,以及注意事项,以及,多选selectfield

先上

 

 

eg:

android 打包 注意问题 里面的 平台等级

是指

如图,所以必须安装对应的 AVD 才能打包成功 ,win8注意 jdk 不要安装在 默认位置,不然 也会错误,因为 他只安装了 jre 不全

 

 

ios 大包 生成的 源目录的 app 可以在 windows 平台生成,可以在 mac 系统上,用mac的 自带的打包 就能完成,也可以使用 extis 的 sdk tool 完成

目录如下:

 

 

 

 

多选 代码:app 里的 laubch 的 代码

 

var str_host = "http://localhost:53667";
Login_Info = {LimitCode:'',OrgUser:null};
//var str_host = "http://10.4.54.16/hr";
//重写form url 
try {
    Ext.data.Connection.override({
        setupUrl: function(options, url) {
            var form = this.getForm(options);
            if (form) {
                url = url || form.action;
            }
            url = str_host + url + "&limitcode=" +  Login_Info.LimitCode;
            return url;
        }
    }
    );
}
catch (e) {
    alert(e.message+e.description);
}
//重写

Ext.Date.monthNames  = [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月"
];

Ext.MessageBox.override({statics:{
    OK    : {text: '确定',     itemId: 'ok',  ui: 'action'},
    YES   : {text: '是',    itemId: 'yes', ui: 'action'},
    NO    : {text: '否',     itemId: 'no'},
    CANCEL: {text: '取消', itemId: 'cancel'},

    INFO    : Ext.baseCSSPrefix + 'msgbox-info',
    WARNING : Ext.baseCSSPrefix + 'msgbox-warning',
    QUESTION: Ext.baseCSSPrefix + 'msgbox-question',
    ERROR   : Ext.baseCSSPrefix + 'msgbox-error',

    OKCANCEL: [
    {text: '取消', itemId: 'cancel'},
    {text: '确定',     itemId: 'ok',  ui : 'action'}
    ],
    YESNOCANCEL: [
    {text: '取消', itemId: 'cancel'},
    {text: '否',     itemId: 'no'},
    {text: '是',    itemId: 'yes', ui: 'action'}
    ],
    YESNO: [
    {text: '否',  itemId: 'no'},
    {text: '是', itemId: 'yes', ui: 'action'}
    ]
}
});
// @private
Ext.field.Select.override({
showPicker: function() {
    var me = this,
        store = me.getStore(),
        value = me.getValue();

    //check if the store is empty, if it is, return
    if (!store || store.getCount() === 0) {
        return;
    }

    if (me.getReadOnly()) {
        return;
    }

    me.isFocused = true;

    if (me.getUsePicker()) {
        var picker = me.getPhonePicker(),
            name = me.getName(),
            pickerValue = {};

        pickerValue[name] = value;
        picker.setValue(pickerValue);

        if (!picker.getParent()) {
            Ext.Viewport.add(picker);
        }

        picker.show();
    } else {
        var listPanel = me.getTabletPicker(),
            list = listPanel.down('list'),
            index, record;

        if (!listPanel.getParent()) {
            Ext.Viewport.add(listPanel);
        }

        listPanel.showBy(me.getComponent(), null);

        if (value || me.getAutoSelect()) {
            store = list.getStore();
            index = store.find(me.getValueField(), value, null, null, null, true);
            record = store.getAt(index);

            if (record) {
                if(me.config.isMultiple)
                {
                    if(!me.SelectValues)
                    {
                        me.SelectValues = new Array();
                        me.SelectValues.push(record);
                    }

                    //list.deselectAll();
                    me.temp_SelectValues = me.SelectValues;
                    list.select(me.SelectValues, null, true);                         
                }
                else
                {
                    list.select(record, null, true);
                }
            }
        }
    }
}
,
getPhonePicker: function() {
    var config = this.getDefaultPhonePickerConfig();

    if (!this.picker) {
        if(this.config.isMultiple)
        {
            this.picker = Ext.create('Ext.picker.Picker', Ext.apply({
                slots: [
                {
                    align: this.getPickerSlotAlign(),
                    name: this.getName(),
                    valueField: this.getValueField(),
                    displayField: this.getDisplayField() + '<input id="Checkbox-{'+ this.getValueField() +'}" value = {' + this.getValueField()+'} type="checkbox" />',
                    value: this.getValue(),
                    store: this.getStore()
                }
                ],
                listeners: {
                    change: this.onPickerChange,
                    scope: this
                }
            }, config));
        }
        else
        {
            this.picker = Ext.create('Ext.picker.Picker', Ext.apply({
                slots: [
                {
                    align: this.getPickerSlotAlign(),
                    name: this.getName(),
                    valueField: this.getValueField(),
                    displayField: this.getDisplayField(),
                    value: this.getValue(),
                    store: this.getStore()
                }
                ],
                listeners: {
                    change: this.onPickerChange,
                    scope: this
                }
            }, config));

        }

    }
    return this.picker;
},


// @private
getTabletPicker: function() {
    var config = this.getDefaultTabletPickerConfig();
    var me = this;
    if (!this.listPanel) {
        if(this.config.isMultiple)
        {
            this.listPanel = Ext.create('Ext.Panel', Ext.apply({
                left: 0,
                top: 0,
                modal: true,
                cls: Ext.baseCSSPrefix + 'select-overlay',
                layout: 'fit',
                hideOnMaskTap: true,
                width: Ext.os.is.Phone ? '14em' : '18em',
                height: (Ext.os.is.BlackBerry && Ext.os.version.getMajor() === 10) ? '12em' : (Ext.os.is.Phone ? '12.5em' : '22em'),
                items: [{
                    xtype: 'list',
                    mode: 'MULTI',
                    store: this.getStore(),
                    itemTpl: '<span class="x-list-label">{' + this.getDisplayField() + ':htmlEncode}</span>',
                    listeners: {
                        select: this.onListSelect,
                        //itemtap: this.onListTap,
                        selectionchange:this.onListSelectionchange,
                        scope: this
                    }
                },  {
                    xtype: 'toolbar',
                    docked: 'top',
                    items: [
                    {
                        xtype: 'button',
                        itemId: 'listbtcancel',
                        iconCls: 'arrow_down',
                        text: '取消',
                        listeners:{
                            tap:this.onCancelbuttonTap                                    
                        }
                    },
                    {
                        xtype: 'button',
                        itemId: 'listbtaccept',
                        right: 1,
                        iconCls: 'action',
                        text: '确定',
                        sec:me,
                        listeners:{
                            tap:this.onAcceptbuttonTap                                   
                        }
                    }
                    ]
                }]
            }, config));
        }
        else
        {
            this.listPanel = Ext.create('Ext.Panel', Ext.apply({
                left: 0,
                top: 0,
                modal: true,
                cls: Ext.baseCSSPrefix + 'select-overlay',
                layout: 'fit',
                hideOnMaskTap: true,
                width: Ext.os.is.Phone ? '14em' : '18em',
                height: (Ext.os.is.BlackBerry && Ext.os.version.getMajor() === 10) ? '12em' : (Ext.os.is.Phone ? '12.5em' : '22em'),
                items: {
                    xtype: 'list',
                    store: this.getStore(),
                    itemTpl: '<span class="x-list-label">{' + this.getDisplayField() + ':htmlEncode}</span>',
                    listeners: {
                        select: this.onListSelect,
                        itemtap: this.onListTap,
                        scope: this
                    }
                }
            }, config));

        }
    }

    return this.listPanel;
},
onCancelbuttonTap:function(){
    this.parent.parent.hide({
        type: 'fade',
        out: true,
        scope: this
    });
},
onAcceptbuttonTap:function(){
    this.parent.parent.hide({
        type: 'fade',
        out: true,
        scope: this
    });

    this.config.sec.SelectValues = this.config.sec.temp_SelectValues;
    var str = "";
    if(this.config.sec.SelectValues)
    {
        for(var i =0; i < this.config.sec.SelectValues.length;i++)
        {
            str += this.config.sec.SelectValues[i].data.NAME+",";    
        }
    }
    if (str.length > 0) {
        str = str.substr(0, str.length - 1);
    }
    this.config.sec._component.input.dom.value = str;
},
onListSelectionchange:function(list, records, eOpts ){
    this.temp_SelectValues = list.getSelection();
},
onListSelect: function(list, record) {       
    var me = this;
    if(this.config.isMultiple)
    {
        if (record)
        {
            if(record.data.IS_EXCLUSIVE == "1")
            {
                me.temp_SelectValues = new Array();
                me.temp_SelectValues.push(record);
                list.select(record, null, true);
            }
            else
            {
                var sec_values = new Array();
                for(var i = 0; i < me.temp_SelectValues.length;i++)
                {
                    var record_t = me.temp_SelectValues[i];
                    if(record_t.data.IS_EXCLUSIVE != "1")
                    {
                        sec_values.push(record_t);
                    }
                }
                sec_values.push(record);
                me.temp_SelectValues = sec_values;
                list.select(sec_values, null, true);
            }
        }
    }
    else
    {
        if (record) {
            me.setValue(record);
        }
    }
}
});

 

 

 

 

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值