#1 2016-10-10 11:01:33

reg4app
Member
Registered: 2016-05-16
Posts: 147

Is that a way to Pop-up a calendar to let user chose a date?

hi every ones:)
I want to let user  to select a date value,can i Pop-up a calendar ?


Joshua.Y

Offline

#2 2016-10-10 11:05:07

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: Is that a way to Pop-up a calendar to let user chose a date?

Hello Joshua,

Although is possible to deal with the Bootstrap CSS framework's datepicker (see this app sample DatePicker.ab) currently this kind of control is not available "out-of-the-box" in App Builder. However, maybe you want to take a look at the "Datetime" sample included in AB: we can always use some Select controls in order to prepare a date picker, and, in fact, probably this is a good aproach if our application is intended for mobile (small screens) devices.

Offline

#3 2016-10-10 11:25:28

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: Is that a way to Pop-up a calendar to let user chose a date?

Hi David,I know you will be here at this time,Thanks,I will look into it!
^_^


Joshua.Y

Offline

#4 2016-10-10 11:42:58

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: Is that a way to Pop-up a calendar to let user chose a date?

Hello Joshua,

reg4app wrote:

Hi David,I know you will be here at this time,Thanks,I will look into it!
^_^

Always at your service! And I want to add one thing more... remember we can show app's views as modal dialogs using the "ShowDialog" action. So the Select controls to conform a datepicker can perfectly be put into an specific app's view in order to be shown as a dialog. Of course this is optional, and, can be good in certain scenarios, but not always, in the sense that also "normal" views (non modal) can have specific stuff (a datepicker) to be shown when we wanted.

Anyway it's an idea! wink

Offline

#5 2016-10-11 05:52:06

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: Is that a way to Pop-up a calendar to let user chose a date?

the DatePicker.ab seems only can pick the date >=current date?
and can i set the date format??

:cool


Joshua.Y

Offline

#6 2016-10-11 10:41:08

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: Is that a way to Pop-up a calendar to let user chose a date?

Hello Joshua,

reg4app wrote:

the DatePicker.ab seems only can pick the date >=current date?
and can i set the date format??

:cool

You can start with this Datepicker documentation. Remember this controls doesn't exists "out-of-the-box" in App Builder. My recomendation is to use some Select controls: more easy, full supported and usable in small and larger screens!

Offline

#7 2016-10-12 04:28:34

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: Is that a way to Pop-up a calendar to let user chose a date?

I am just doing some test ,and this test is for pad,so the size would not be a problem

and this website:angular-ui.github.io ,contain a lot of information about JS,nice to study

can I get this 'Bootstrap CSS framework' in my AB project,and later build into a Cordova application?


Joshua.Y

Offline

#8 2016-10-12 09:56:12

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: Is that a way to Pop-up a calendar to let user chose a date?

Hello Joshua,

Yes; in fact App Builder already includes that Javascript stuff, and use it "out-of-the-box" in various controls. But not all, like the Datepicker control. So you can always try with the HTML control, but don't worry about include the Javascript stuff, since they are already included in AB. If you have ANY further question, please, don't hesitate to post here sir.

Offline

#9 2016-10-13 12:59:28

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: Is that a way to Pop-up a calendar to let user chose a date?

Hello Joshua,

Take a look if you like at the new Date input control available in App Builder. You can start by the also new DateInput app sample. The below one is a sample of the datepicker that Android 6.1 offer to us to choose a date using the new Date input:

TAX1XIu.png

Offline

#10 2016-10-17 04:44:10

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: Is that a way to Pop-up a calendar to let user chose a date?

....I just want to say:You are really efficient
Thanks for the work

smile and smile


Joshua.Y

Offline

#11 2016-10-17 05:25:50

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: Is that a way to Pop-up a calendar to let user chose a date?

try the Date input sample
can I set a Javascript Date back to String ,like:
Thu Oct 13 2016 00:00:00 GMT+0800  -> 2016-10-13


Joshua.Y

Offline

#12 2016-10-17 08:11:47

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: Is that a way to Pop-up a calendar to let user chose a date?

Hello Joshua,

Thanks for your kindly words. About your question, the Date input control requires a JS Date variable to be binded. This is does automatically by App Builder. If we need to play with the JS Date variable (the Date input value) we can first create a new AB Data variable with "NewDate" using the input's value.

Then, once we have an AB Data variable we can use actions like DateFormat with that variable.

Probably we can use also another approach (depend on your needs) like a bit of Javascript code, in order to do something like that:

StartJS
  alert( $rootScope.Input1.Value.toString() );
EndJS

Remember the "Value" is a JS Date variable, so we can also use another Date Javascript stuff if we wanted (if we must use the input's value from Javascript code). So take a look and tell me if you have any further question Joshua.

Offline

#13 2016-10-17 09:12:44

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: Is that a way to Pop-up a calendar to let user chose a date?

This can work:
add a js file

Date.prototype.Format = function (fmt) { //author: meizz 
    var o = {
        "M+": this.getMonth() + 1, 
        "d+": this.getDate(),  
        "h+": this.getHours(), 
        "m+": this.getMinutes(),  
        "s+": this.getSeconds(),  
        "q+": Math.floor((this.getMonth() + 3) / 3), 
        "S": this.getMilliseconds() 
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
}

in AB

StartJS
  alert( $rootScope.DateInput.Value.Format("yyyy-MM-dd") );
  $rootScope.Input1.Value=$rootScope.DateInput.Value.Format("yyyy-MM-dd");
EndJS

Joshua.Y

Offline

#14 2016-10-17 09:17:46

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: Is that a way to Pop-up a calendar to let user chose a date?

Hello Joshua,

But remember we have the DateFormat action. We can do something like this:

// Create an AB Date variable from the input's value (JS Date variable)
NewDate "[Input1.Value]" "" "[MyDate]"

// Format the AB Date variable as we wanted (see DateFormat's help)
DateFormat "[MyDate]" "YYYY-MM-DD" "[Result]"

// Show the resulting string
AlertBox "[Result]" "info"

Offline

#15 2016-10-17 09:44:45

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: Is that a way to Pop-up a calendar to let user chose a date?

Oh,I get that,
I just try some js in AB,to help me learn it through

DateFormat action ,of course ,more convenient!


Joshua.Y

Offline

#16 2016-10-17 09:46:00

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: Is that a way to Pop-up a calendar to let user chose a date?

Hello Joshua,

reg4app wrote:

Oh,I get that,
I just try some js in AB,to help me learn it through

DateFormat action ,of course ,more convenient!

Learn is good. Dot. And it's good to know different usages/alternatives. smile

Offline

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.