标签: sencha-touch-2

如何在Sencha Touch 2型号中存储日期

在sencha touch 2中,似乎只有string,int,float,boolean数据类型.那么如何存储日期时间?

UPDATE

好的,我发现我可以convert()用来转换值:http://docs.sencha.com/touch/2-0/#!/api/Ext.data.Types

convert:Function(函数)将原始数据值从数据块转换为要存储在Field中的数据的函数.该函数传递了collowing参数:
- v:Mixed
Reader读取的数据值,如果未定义,将使用配置的defaultValue.
- rec:Mixed
包含Reader读取的行的数据对象.根据Reader类型,它可以是Array(ArrayReader),对象(JsonReader)或XML元素.

// Add a new Field data type which stores a VELatLong object in the Record.
Ext.data.Types.VELATLONG = {
    convert: function(v, data) {
        return new VELatLong(data.lat, data.long);
    },
    sortType: function(v) {
        return v.Latitude;  // When sorting, order by latitude
    },
    type: 'VELatLong'
};
Run Code Online (Sandbox Code Playgroud)

但我真的不懂代码.对于convert(),什么设置参数?为什么第一个参数未被使用,何时以及它用于什么?如何获取/设置此类自定义类型(它是否成为vdata存在convert())?

extjs sencha-touch sencha-touch-2

8
推荐指数
2
解决办法
5871
查看次数

在Sencha touch2中如何启用浏览器的滚动条

出于某种原因,我喜欢使用浏览器的原生滚动条而不是sencha.

我已经设置了溢出到auto到body,但是直到我在chrome工具栏中手动设置固定高度为"ext-viewport"时才看到滚动条,如2000px.

它看起来像视口始终自动适应屏幕大小.是否有任何设置来禁用此功能并启用浏览器的滚动?

提前致谢.


5月19日更新 这里有一些进展,

  1. Ext.viewport.Android- > doFixSize将自动调整视口到屏幕大小,注释掉然后设置/检测固定
  2. Ext.viewport.Default,它燕子touchstart/touchmove事件,这样滚动条不能正常工作,通过设置preventPanning/preventZoomingfalse我可以得到滚动条的工作.它比sencha的滚动条滚动得快得多:)

旋转木马现在不能正常工作,调查......


6月20日更新

由于以下错误,Carousel将无法使用android 4中的原生滚动条 http://code.google.com/p/android/issues/detail?id=19827

使用原生滚动条,只调用touchstart并调用第一个touchmove事件,后续的touchmove和touchend将丢失,因此如果没有e.preventDefault(),则无法实现轮播.

一个workround是监听触摸事件,当事件目标是轮播时,然后调用e.preventDefault来禁用本机滚动条....

sencha-touch-2

8
推荐指数
1
解决办法
1581
查看次数

WARN当前工作目录不是可识别的Sencha SDK或应用程序文件夹

我正在使用mac,我刚刚下载了SDK并破坏了应用程序.安装成功,但从终端使用sencha时

$ cd /Applications/SenchaSDKTools-2.0.0-beta3 
$ sencha
Run Code Online (Sandbox Code Playgroud)

我收到此错误

[WARN] The current working directory (/Applications/SenchaSDKTools-2.0.0-beta3) is not a recognized Sencha SDK or application folder. Running in backwards compatible mode.

Sencha Command v2.0.0 Beta 3
Copyright (c) 2012 Sencha Inc.
Run Code Online (Sandbox Code Playgroud)

知道怎么解决吗?我正在使用MAC 10.7.4

PS

我正在写一个额外的命令,我可以看到以下 -

$ echo $PATH
/Applications/SenchaSDKTools-2.0.0-beta3:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
Run Code Online (Sandbox Code Playgroud)

extjs sencha-touch sencha-touch-2

8
推荐指数
1
解决办法
9951
查看次数

设置数字字段的值而不在Sencha Touch中触发"更改"事件

我在Sencha Touch中有一个数字字段和一个列表.当我单击列表中的项目时,我正在执行AJAX请求以将数据发送到服务器.但是,如果数字字段中有数据,我想在单击列表时清除它.

我这样做没有问题(我将值设置为空字符串),但是,在数字字段上触发了change事件.这导致另一个不需要的AJAX请求运行.有没有办法清除数字字段而不解雇更改事件?SuspendEvents不起作用,因为清除数字字段需要一个事件.

有什么想法或建议吗?谢谢!

我试过的代码行:

suspendEvents(); me.getWhatScreen().down('numberfield[name=caseNumber]').setValue(''); resumeEvents(true);

me.suspendEvents(); me.getWhatScreen().down('numberfield[name=caseNumber]').setValue(''); me.resumeEvents(true);

events extjs sencha-touch sencha-touch-2

8
推荐指数
1
解决办法
9693
查看次数

在中心垂直对齐项目 - Sencha面板

我试图在一个项目的屏幕中间对齐,label但它是水平对齐而不是垂直对齐.

var panel = new Ext.Panel({
    layout:{
        type: 'vbox',
        align: 'center'
    },
    items:[
        {
            xtype: 'label',
            html: 'My Label'
        }
    ],
    fullscreen: true,
    flex: 1
});
Run Code Online (Sandbox Code Playgroud)

我已删除flex,并设置height,但它不起作用.请给我一些线索?

extjs sencha-touch sencha-touch-2

8
推荐指数
1
解决办法
3万
查看次数

Cordova安装在Linux上

有谁知道如何在Ubuntu/xUbuntu上安装Cordova?

我尝试按照链接和其他来源的指示执行npm install cordova不起作用.

我收到以下很长的错误消息:

root@li141-82:/var/www/mysite# npm install cordova
npm http GET https://registry.npmjs.org/cordova

npm ERR! Error: failed to fetch from registry: cordova
npm ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR!     at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR!     at Request.emit (events.js:88:20)
npm ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
npm ERR!     at ClientRequest.g (events.js:156:14)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1256:7)
npm ERR! You may report …
Run Code Online (Sandbox Code Playgroud)

ubuntu command-line-interface xubuntu sencha-touch-2 cordova

8
推荐指数
2
解决办法
6518
查看次数

不同Android版本的图像渲染差异

我正在尝试使用Sencha Touch构建图库.我创建了一个容器对象,其hbox布局和宽度等于window.innerWidth.然后,我在里面添加三个容器.每个使用vbox布局,宽度等于window.innerWidth/3.

我在其中添加宽​​度等于CSS上设置的列宽和高度的图像为'auto'.

这是我的代码:

Ext.define('Oasis.view.ImgTest',{
extend: 'Ext.Container',
xtype:'mosaic',
config:{
    cls: 'gallery',
    layout: {
        type: 'hbox', // This is a column-based mosaic
        pack: 'center',
        align: 'start'
    },
    columnWidth: -1,//
    numCols: 3, // Number of columns
    lastColumnUsed: -1, // Last column where a image were added. -1 for none.
    autoInstanceColumns: false, // If true, instantiate each column on initialize method
    items:[],
    scrollable: {
        direction: 'vertical',
        directionLock : true
    }
},
initialize: function(){
    var me = this;

    me.setColumnWidth(window.innerWidth/me.getNumCols());

    Ext.Viewport.on('orientationchange', function(){
        // Updates columns …
Run Code Online (Sandbox Code Playgroud)

css html5 android image sencha-touch-2

8
推荐指数
1
解决办法
264
查看次数

sencha touch 2 list 100%height

2个面板:

Ext.create('Ext.Container', {
    fullscreen: true,
    layout: 'hbox',
    items: [
        {
            xtype: 'panel',
            html: 'message list',
            flex: 1,
            items: [
                {
                    xtype: 'list',
                    itemTpl: '{title}',
                    data: [
                        { title: 'Item 1' },
                        { title: 'Item 2' },
                        { title: 'Item 3' },
                        { title: 'Item 4' }
                    ]
                }
            ]
        },
        {
            xtype: 'panel',
            html: 'message preview',
            flex: 3
        }
    ]
});
Run Code Online (Sandbox Code Playgroud)

第一个面板列表对象中没有指定高度属性,因此无法显示.如何在xtype:'list'中设置100%的高度?

sencha-touch-2

7
推荐指数
1
解决办法
8621
查看次数

构建Sencha Touch 2应用程序时出错

当我使用命令构建我的sencha touch 2应用程序时: - sencha app build production

但它会抛出一个错误:

[INFO] Deploying your application to /Applications/MAMP/htdocs/iPadapp/build/production
[INFO] Copied sdk/sencha-touch.js
[INFO] Copied app.js
[INFO] Copied resources/css/app.css
[INFO] Copied resources/images
[INFO] Copied resources/icons
[INFO] Copied resources/loading
[INFO] Resolving your application dependencies...
[ERROR] Error thown from your application with message: TypeError: 'undefined' is not an object
Run Code Online (Sandbox Code Playgroud)

我在我的代码中跟踪了错误.我发现,这是由于加载我的清单.这是我的代码

Ext.define("myProject.store.Members",{
    extend  :'Ext.data.Store',
    requires:"Ext.data.proxy.LocalStorage",
    config: {
        model   :"myProject.model.Member",
        sorters :'lastName',
        autoload:true,

        proxy: {
            type: 'localstorage',
            id  : 'mainStore'
        } 
    }
});
Run Code Online (Sandbox Code Playgroud)

如果我删除行'autoLoad:true'(这会破坏我的应用程序,然后我可以构建应用程序.但是我的列表没有加载.如果我把它重新发送错误重复.我尝试使用加载函数动态加载列表,但是它没有任何意义.

这是我有趣的model.js文件.

Ext.define('myProject.model.Member', {
    extend: 'Ext.data.Model', …
Run Code Online (Sandbox Code Playgroud)

javascript load list sencha-touch sencha-touch-2

7
推荐指数
1
解决办法
2539
查看次数

Sencha触摸2本机构建不加载

生成默认应用程序后:

sencha generate app Sencha ../Sencha
Run Code Online (Sandbox Code Playgroud)

我决定在iOS模拟器上测试应用程序

cd ../Sencha/
sencha app build native
Run Code Online (Sandbox Code Playgroud)

它加载应用程序但卡在加载图标上: Sencha iOS app卡在加载屏幕上

下面是主应用程序(App.js)的代码:

Ext.application({
    name: 'Sencha',

    requires: [
        'Ext.MessageBox'
    ],

    views: ['Main'],

    icon: {
        '57': 'resources/icons/Icon.png',
        '72': 'resources/icons/Icon~ipad.png',
        '114': 'resources/icons/Icon@2x.png',
        '144': 'resources/icons/Icon~ipad@2x.png'
    },

    isIconPrecomposed: true,

    startupImage: {
        '320x460': 'resources/startup/320x460.jpg',
        '640x920': 'resources/startup/640x920.png',
        '768x1004': 'resources/startup/768x1004.png',
        '748x1024': 'resources/startup/748x1024.png',
        '1536x2008': 'resources/startup/1536x2008.png',
        '1496x2048': 'resources/startup/1496x2048.png'
    },

    launch: function() {
        // Destroy the #appLoadingIndicator element
        Ext.fly('appLoadingIndicator').destroy();

        // Initialize the main view
        Ext.Viewport.add(Ext.create('Sencha.view.Main'));
    },

    onUpdated: function() {
        Ext.Msg.confirm(
            "Application Update",
            "This application has just successfully been …
Run Code Online (Sandbox Code Playgroud)

javascript json ios sencha-touch-2

7
推荐指数
1
解决办法
3065
查看次数