Sencha touch 如何在sencha touch中使用第三方扩展
我正试图在这个Sencha touch 如何在sencha touch中使用第三方扩展,sencha-touch,sencha-touch-2,Sencha Touch,Sencha Touch 2,我正试图在这个时间字段上使用第三方扩展。如何在sencha touch 2.1中使用它 编辑 我在ux\picker中添加了扩展,然后使用了以下代码 Ext.define('HB.view.Search', { extend: 'Ext.form.Panel', xtype: 'search', Ext.require(['Ext.ux.picker.DateTimePicker']), config: { title: 'Search', layout: 'fit',
时间字段上使用第三方扩展。如何在sencha touch 2.1中使用它
编辑
我在ux\picker
中添加了扩展,然后使用了以下代码
Ext.define('HB.view.Search', {
extend: 'Ext.form.Panel',
xtype: 'search',
Ext.require(['Ext.ux.picker.DateTimePicker']),
config: {
title: 'Search',
layout: 'fit',
scrollable: true,
styleHtmlContent: true,
styleHtmlCls: 'searchpage',
//html: ['<h1>Welcome to MyApp</h1>'].join(''),
items: [
{
xtype: 'titlebar',
title: 'Search Page',
docked: 'top'
},
{
xtype: 'textfield',
name: 'from',
placeHolder: 'From'
},
{
xtype: 'textfield',
name: 'to',
placeHolder: 'To'
},
{
xtype: 'datepickerfield',
name: 'date',
value: new Date()
},
{
xtype: 'datetimepickerfield',
name: 'time',
value: new Date()
}
]
},
//style: 'height:' + (Ext.getBody().getHeight()) + 'px;'
height: Ext.getBody().getHeight()
});
只需将ux
文件夹中的文件放在项目的ux\picker
文件夹中,然后使用xtype:'datetimepickerfield'
在使用此组件之前,需要先加载所需的文件。您可以使用Ext.require(['Ext.ux.field.DateTimePicker']);执行此操作
DateTimePicker->ux/field/DateTimePicker
DateTime->ux/picker/DateTime
我浪费了6个小时才找到这个问题。在ux
中有两个子文件夹,即auth
和auth2
。那么我需要把它放在其中一个子文件夹中吗?在ux
中没有picker
子文件夹。创建一个:)!这是因为扩展使用Ext.ux.picker作为命名空间。@A1rPun请检查我上面的更新。我对Ext.requires
有问题。请检查我答案中的链接。您使用的Ext.require是错误的,请在定义Ext.require(['Ext.ux.picker.DateTimePicker'])之前这样使用它代码>我按你说的做了,请检查我的更新代码,但它也不起作用。我还检查了你的答案中的链接,因为我是sencha touch的新手,所以如果没有适当的例子,很难理解这一点。
GET http://localhost/HelsinkiBus/touch/src/DateTimePicker.js?_dc=1357800622746 404 (Not Found)
Uncaught Error: [Ext.Loader] Failed loading 'touch/src/DateTimePicker.js', please verify that the file exists