Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use with xtypes? #1

Open
balupton opened this issue Aug 3, 2011 · 1 comment
Open

How to use with xtypes? #1

balupton opened this issue Aug 3, 2011 · 1 comment

Comments

@balupton
Copy link

balupton commented Aug 3, 2011

So I've got the following code:

            items: [
                # Fields
                {
                    xtype: "fieldset"
                    defaults: 
                        required: true
                        labelAlign: "left"
                        labelWidth: "40%"
                    items: [ 
                            xtype: "textfield"
                            name: "name"
                            label: "Name"
                            placeHolder: 'My Event'
                            useClearIcon: true
                        , 
                            xtype: "textfield"
                            name: "description"
                            label: "Description"
                            placeHolder: 'is awesome'
                            useClearIcon: true
                        , 
                            new Ext.ux.touch.DateTimePicker(
                                useTitles: true
                                id: "dt"
                                value: 
                                    day: 23
                                    month: 2
                                    year: 2000
                                    hour: 13
                                    minute: 45
                                listeners: hide: (picker) ->
                                    window.alert (picker.getValue())
                            )
                    ]
                },

                # Actions
                {
                    xtype: "fieldset"
                    items: [ 
                        xtype: "button"
                        text: "Submit Event"
                        ui: "confirm"
                        handler: ->  
                            Evently.Views.eventForm.submit waitMsg: 
                                message: "Submitting"
                                cls: "demos-loading"
                    ]
                }
            ]

However that is not rendering the DateTimePicker correctly, is there a way to use it with xtypes like the other two fields?

@olegtaranenko
Copy link
Contributor

looks like you are using CoffeScript...
'usual' syntax is e.g.:

        items: [
            {
                xtype: "datetimepickerfield",
                label: _("Date"),
                name: 'TheDate',
                init_to_now: false,
                picker: {
                    showYears: true,
                    yearFrom: new Date().getFullYear() - 1,
                    yearTo: new Date().getFullYear() + 1,
                    useTitles: true,
                    minuteScale: 10
                },
                listeners: {
                    scope: this,
                    afterrender: function(ct) {
                        TheDate = ct;
                    },
                    change: function (ct, the) {
                        var model = this.record;
                        model.set('TheDate', the);
                    }

                }
            }
          ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants