Search code examples
sencha-touchsencha-touch-2

how to use third party extension in sencha touch


I am trying to use third party extension on this link for only time field. How can I use it in sencha touch 2.1?

Edit

I added the extension in ux\picker and then I used following code

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()
});

But it gives me this error

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 

Solution

  • Just place the files from the ux folder in ux\picker folder in your project and use xtype: 'datetimepickerfield'.
    Before you can use this component you need to load the files needed first. You can do this with Ext.require