cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
landon
Super User (Alumni)

Does anyone have a date picker widget in JSL (like https://jqueryui.com/datepicker/) that could be put into a New Window user dialog?

Does anyone have a date picker widget in JSL (like https://jqueryui.com/datepicker/) that could be put into a New Window user dialog?

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

Re: Does anyone have a date picker widget in JSL (like https://jqueryui.com/datepicker/) that could be put into a New Window user dialog?

newwindow("date demo", d=numbereditbox(77,9,<<setformat(Format( "Monddyyyy h:m:s", 22, 0 ))));

when the number edit has a date format assigned, rolling over it with the mouse shows a blue triangle.  Click the triangle.

10989_date.png

Craige

View solution in original post

4 REPLIES 4
Craige_Hales
Super User

Re: Does anyone have a date picker widget in JSL (like https://jqueryui.com/datepicker/) that could be put into a New Window user dialog?

newwindow("date demo", d=numbereditbox(77,9,<<setformat(Format( "Monddyyyy h:m:s", 22, 0 ))));

when the number edit has a date format assigned, rolling over it with the mouse shows a blue triangle.  Click the triangle.

10989_date.png

Craige
landon
Super User (Alumni)

Re: Does anyone have a date picker widget in JSL (like https://jqueryui.com/datepicker/) that could be put into a New Window user dialog?

Thanks for the quick reply from many pointing me to this built-in feature. I now see this is mentioned at Constructing Display Trees

pmroz
Super User

Re: Does anyone have a date picker widget in JSL (like https://jqueryui.com/datepicker/) that could be put into a New Window user dialog?

JMP 11 and 12 comes with a built-in date picker for numbereditboxes:

nw = new window("Example Date Picker",

      hlistbox(

            textbox("Choose a date: "),

            dteb = numbereditbox(0),

      ),

      ok_button = button box("OK", date_value = dteb << get),

dteb << set format(format("ddMonyyyy")),

dteb << set width(12),

dteb << set(today()),

);

If this doesn't suit your needs I posted a calendar dialog box a while back in the file exchange, but it looks like it's been removed.

vince_faller
Super User (Alumni)

Re: Does anyone have a date picker widget in JSL (like https://jqueryui.com/datepicker/) that could be put into a New Window user dialog?

Adding onto Craig's answer, here is a "date_box()" that you can call to make it do that functionality as well.  This also defaults to a date so it doesn't just blank out if you accidentally insert insert a character or something. 

date_box = function(//makes a calendar come up on a numeditbox that is a little more robust

       //Note, this only works on JMP 11+

       {timething = Today()}, {newbox},

       newbox = Eval(substitute(NameExpr(number edit box(timething, //Eval(Sub()) because of JMP quirk

              10,//just need this because JMP doesn't default a width

              <<Set function(function({self},{},

                     if(ismissing(self<<get),

                           self<<Set(Eval(DUMMY))//sets the date to the timething argument

                     )

              )),

              <<Set Format(Format("m/d/y h:m:s", 23, 0));//makes datetime format for the box (gives calendar)

             

       )), EXPR(DUMMY), timething));

       newbox;

);


then you can just :

nw = new window("Date Box",

       date_box(), //defaults to now

       date_box(Today()-5*60*60), // Set to 5 hours ago

);


10990_pastedImage_0.png


Vince Faller - Predictum