danielhanold / danielhanold.pickerwidget Goto Github PK
View Code? Open in Web Editor NEWTitanium widget that implements single column, date, and age-range pickers for iOS and Android
Titanium widget that implements single column, date, and age-range pickers for iOS and Android
So on Android does not support Ti.UI.PICKER_TYPE_DATE_AND_TIME, therefore only Ti.UI.PICKER_TYPE_DATE can be used. However, the minDate is not taking effect.
hi
when we add single column dynamic add pickerrow more then 100 ,picker hang and display Empty List in Iphone
Hey,
on your picture (android, third) the text inside the rows is black - can you clearify how to achieve this? For me it's white - can't read it. :/
Best,
Nico
Hi,
How can I add open the picker when I click in a text field for example ?
Tks,
Hi,
Im working with alloy and while fetching a collection, the data of the response is a JSON Array. This is not working because the data expected is:
[{10: 'Auburn', 20: 'Bald', 30: 'Black', 40: 'Blond', 50: 'Brown'}],
Ideas?
Daniel,
Great job on the widget. Works beautifully except for the cancel
button and the minDate
assignment. Very possible I'm doing something wrong.
First, the cancel button:
When selecting it, I get an error.
[ERROR] : message = "'null' is not an object (evaluating 'e.data.date')";
(e.data.date
is defined in the onDone
callback)
At first, I thought this occurred when I simply opened and closed the picker without selecting a value. Not true. The error occurred regardless.
Next is the minDate
variable. I use moment.js to calculate the value
var minDate = moment().subtract('years', 2);
which returns the correct value
[INFO] : [balances] minDate = "2012-08-15T16:18:59.332Z"
I have minDate defined in pickerParams
:
pickerParams : {
minDate : minDate,
maxDate : maxDate,
value : defaultDate,
maxSelectedDate : maxSelectedDate,
maxSelectedDateErrorMessage : 'Cannot select future dates.'
},
However, the user is able to select a date older than the minimum. I am expecting minDate
to disallow selections older than this date, which is the converse of maxDate
where the user cannot select any date forward of 'maxDate`.
I would appreciate your assistance on how to resolve these issues. Thanks.
Using:
The code below:
$.picker.blur();
// Date Picker example.
// Set minimum date to 1900.
var minDate = new Date(new Date().setYear(1900));
// Set minimum date to today
var maxDate = new Date();
// Will load the last value
var _pickerValue = $.picker.getValue();
console.log('[*] Current Birth Date.');
console.log(_pickerValue);
var defaultValue = (_pickerValue) ? moment(_pickerValue, 'M/D/YYYY').toDate() : maxDate;
var maxSelectedDate = new Date();
var overlay = Alloy.createWidget('danielhanold.pickerWidget', {
id: 'myDatePicker',
outerView: $.mainWindow,
hideNavBar: false,
type: 'date-picker',
pickerParams: {
minDate: minDate,
maxDate: maxDate,
value: defaultValue,
maxSelectedDate: maxSelectedDate,
maxSelectedDateErrorMessage: 'The Person must be Born First!'
},
onDone: function(e) {
var _date = (e.data && e.data.unixMilliseconds) ? e.data.unixMilliseconds : null;
if (!_date) {
$.picker.setValue('');
return;
}
picker_date = moment(_date).format('l');
$.picker.setValue(picker_date);
},
});
On some devices the date picker displays a calendar instead of 3 spinners to select the date. This is OK on the Nexus 9 (probably because the screen is large because it's a tablet) but on the Galaxy S6 the calendar date picker overlaps the cancel and done buttons making it impossible to leave the date picker widget.
i m trying to use this by clicking on label and setting the selected value as text on the label....can you plz tell me how to get text of the selected value...
If I use the date picker, including the example code randomly when activating it on iOS I get the following
[ERROR] Script Error {
[ERROR] backtrace = "#0 Controller() at file:///Users/stephen/Library/Developer/CoreSimulator/Devices/C248FB08-0174-49E1-9DFF-4292F6CF857C/data/Containers/Bundle/Application/DA3E6DB4-6F4F-40BD-97A2-C307F8CE5C52/La%20Tasca.app/alloy/widgets/danielhanold.pickerWidget/controllers/widget.js:236\n#1 () at file:///Users/stephen/Library/Developer/CoreSimulator/Devices/C248FB08-0174-49E1-9DFF-4292F6CF857C/data/Containers/Bundle/Application/DA3E6DB4-6F4F-40BD-97A2-C307F8CE5C52/La%20Tasca.app/alloy.js:260\n#2 () at file:///Users/stephen/Library/Developer/CoreSimulator/Devices/C248FB08-0174-49E1-9DFF-4292F6CF857C/data/Containers/Bundle/Application/DA3E6DB4-6F4F-40BD-97A2-C307F8CE5C52/La%20Tasca.app/alloy/controllers/register.js:328";
[ERROR] line = 78;
[ERROR] message = "-[UIPickerView setDatePickerMode:]: unrecognized selector sent to instance 0x797ceba0";
[ERROR] sourceId = 325739168;
[ERROR] sourceURL = "file:///Users/stephen/Library/Developer/CoreSimulator/Devices/C248FB08-0174-49E1-9DFF-4292F6CF857C/data/Containers/Bundle/Application/DA3E6DB4-6F4F-40BD-97A2-C307F8CE5C52/La%20Tasca.app/alloy/widgets/danielhanold.pickerWidget/controllers/widget.js";
[ERROR] }
Which appears to be this line
picker.setType(Ti.UI.PICKER_TYPE_DATE);
However, I have noticed that if I change line 7 of pickerView.js from
if (args.type === 'date-picker' && OS_ANDROID)
to
if (args.type === 'date-picker')
It works fine.
This has been happening on both iOS 8 and 8.1
I have uploaded a video showing this behaviour https://dl.dropboxusercontent.com/u/239816/Untitled.m4v
It is just a view with a label with an onClick button
in case >>> type : 'date-picker'
when click on cancel it will apear this message ([ERROR] message = "null is not an object ")
When i select one item, the selected index is not the key of the pickerValues object.
Crash on android samsung GT-I9505
os version : 5.0.1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.