在sencha touch中选择选项不适用于android [英] Select options in sencha touch is not working for android

查看:128
本文介绍了在sencha touch中选择选项不适用于android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,我正在使用sencha touch JS API进行UI渲染。 Chrome浏览器中的UI可以正常工作,但在Android或iPhone设备中无法使用。



我使用了以下代码。

  Ext.regModel('Contact',{
fields:['firstName','lastName']
});

var store1 = new Ext.data.JsonStore({
model:'Contact',
autoLoad:true,
autoDestroy:true,
data :[
{firstName:'Tommy',lastName:'Maintz'},
{firstName:'Rob',lastName:'Dougan'},
{firstName:'Ed',lastName :'Spencer'},
{firstName:'Abraham',lastName:'Elias'},
{firstName:'Jay',lastName:'Robinson'}
]
});

new Ext.Application({
launch:function(){
var panel = new Ext.Panel({
fullscreen:true,
id :'thePanel',
layout:'auto',
style:'background-color:darkblue',
scroll:'vertical'
});
/ /在动态调用函数
var list = new Ext.List({
id:'theList',
itemTpl:'{firstName} {lastName}',
store:store1,
width:'100%',
scroll:false
});

var stateList = new Ext.form.Select({
label:'State',
widht:'100%',
options:[
{text:'First Option',value:'first'},
{ text:'Second Option',value:'second'},
{text:'Third Option',value:'third'}
],
autoLoad:true,
autoDestroy:true
});

pa nel.items.add(list);
panel.items.add(stateList);
panel.doLayout();
}
});



它给出了像图像中所示的UI。但是select控件不工作(状态列表不填充)。请帮帮我。

解决方案

每个表单字段都需要一个name属性,即在提交表单时要发送的参数的名称。更新您的stateList对象,如下所示:

  var stateList = new Ext.form.Select({
label:'State ',
name:'selectField',
width:'100%',
options:[
{text:'First Option',value:'first'},$
{text:'Third Option',value:'third'}
],
autoLoad:true,
autoDestroy:true

});


I have an application where i am using sencha touch JS API for UI rendering. The UI works fine in chrome browser but not working in Android or iPhone device.

i have used the following code.

    Ext.regModel('Contact', {
    fields: ['firstName', 'lastName']
});

var store1 = new Ext.data.JsonStore({
    model  : 'Contact',
    autoLoad : true,
           autoDestroy : true, 
    data: [
        {firstName: 'Tommy',   lastName: 'Maintz'},
        {firstName: 'Rob',     lastName: 'Dougan'},
        {firstName: 'Ed',      lastName: 'Spencer'},        
        {firstName: 'Abraham', lastName: 'Elias'},
        {firstName: 'Jay',     lastName: 'Robinson'}
    ]
});

new Ext.Application({
    launch: function() {
       var panel =  new Ext.Panel({
            fullscreen: true,
            id:'thePanel',
            layout: 'auto',
            style: 'background-color:darkblue',
            scroll:'vertical'
        });
//do this in your dynamically called function
    var list = new Ext.List({
        id :'theList',
        itemTpl : '{firstName} {lastName}',
        store: store1,
        width: '100%',
        scroll:false
    });

var stateList = new Ext.form.Select({
    label : 'State',
    widht: '100%',
    options: [
        {text: 'First Option',  value: 'first'},
        {text: 'Second Option', value: 'second'},
        {text: 'Third Option',  value: 'third'}
    ],
    autoLoad : true,
    autoDestroy : true
});

    panel.items.add(list);
    panel.items.add(stateList);
    panel.doLayout();               
    }
});

It gives the UI like as shown in the image. But the select control is not working for (State list in not populating). please help me.

解决方案

Each form field needs to have a name property, i.e. the name of the parameter to be send when the form is submitted. Updated your stateList object like this:

var stateList = new Ext.form.Select({
label : 'State',
name: 'selectField',
width: '100%',
options: [
    {text: 'First Option',  value: 'first'},
    {text: 'Second Option', value: 'second'},
    {text: 'Third Option',  value: 'third'}
],
autoLoad : true,
autoDestroy : true

});

这篇关于在sencha touch中选择选项不适用于android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆