-
8 Nov 2012 1:19 PM #1
Answered: Sencha Touch 2.1 Problem with DatePicker
Answered: Sencha Touch 2.1 Problem with DatePicker
I just upgraded my application to use Sencha Touch 2.1. I've been able to get almost everything working the same as with ST 2.0.1, but I am having trouble with Ext.field.DatePicker. When I click on the date picker field, the box opens full size, but the picker is only about 1 pixel wide.
Here is my form code:
Here is an image of what I see when I try to pick a date:Code:var curDate = new Date(); var year = curDate.getFullYear(); Ext.define("dcwtouch.view.LeadEntryParentForm", { extend: 'Ext.form.Panel', requires: ['Ext.field.Select', 'Ext.field.DatePicker'], xtype: 'leadEntryParentForm', config: { id: 'leadEntryParentForm', record: 'dcwtouch.model.LeadModel', height: window.innerHeight-145, items: [ { xtype: 'fieldset', id: 'parent-fieldset', title: 'Lead Entry - Parent Information', defaults: { required: true, labelWidth: '35%' }, items: [ { //... various form fields },{ xtype: 'datepickerfield', name: 'birthDate', label: 'Birthday', id: 'birthday2', value: 'birthDate', required: true, picker: { cancelButton: 'Clear', yearFrom: 1994, yearTo: year+1 } } ] },{ xtype: 'button', text: 'Continue', margin: '0 50 0 50', ui: 'confirm', action: 'parentContinue' } ], } });
DatePicker.jpg
Any assistance will be much appreciated. Thanks.
UPDATE: I get the above result when I test on my desktop using Chrome. When I test using Safari, I do not even get the 1 pixel-wide picker, just the background and title bar with the buttons. I get this same result when I tested my app on my android tablet.
-
Best Answer Posted by ghawazigirl
I got it working. mitchellsimoens comment about DatePicker working with the default CSS made me review the SCSS file that I had updated for my application. My '@include sencha-picker;' statement was in a different location further down the list than in the 2.1 SCSS file. When I moved it up to match the same order as with ST 2.1, the DatePicker displayed properly. I figured that I had made some simple, but easily overlooked, error and I was right.
-
10 Nov 2012 5:51 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,656
- Vote Rating
- 435
- Answers
- 3108
It's working fine for me in Chrome, Safari and iOS 6 in 2.1.0 and with default CSS
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
10 Nov 2012 10:58 AM #3
Most likely the parent container of the datePicker does not come with a width of 100%.
Check out in Chrome what happens if you set the width of the picker manually to 300px.
Then test the parent containers until you get the desired result.
-
12 Nov 2012 7:56 AM #4
I got it working. mitchellsimoens comment about DatePicker working with the default CSS made me review the SCSS file that I had updated for my application. My '@include sencha-picker;' statement was in a different location further down the list than in the 2.1 SCSS file. When I moved it up to match the same order as with ST 2.1, the DatePicker displayed properly. I figured that I had made some simple, but easily overlooked, error and I was right.


Reply With Quote