Skip to main content
4-Participant
December 16, 2024
Solved

How to pass and enable only selected dates inside datePicker widget in ThingWorx 9.4

  • December 16, 2024
  • 2 replies
  • 1863 views

Hello everyone,

I need to create a datePicker where:

1. I want to send multiple dates (like 28, 30, 2) to the datePicker Widget. These dates are stored in a database, so can I pass them using the service?
2. Only the dates provided to the datePicker should be enabled, while all other dates should be disabled. Can this be done in ThingWorx 9.4?

If this isn't feasible with the datePicker, is there an alternative solution? Please see the attached screenshot for reference.

Best answer by Rocko

The selected dates would be the Selected Rows on the Data source you connected to the collection.

You can try either to bind that infotable to a mashup parameter (see in the community how to pass values back from a sub-mashup),

or you can set it as a session value.

 

2 replies

Rocko
19-Tanzanite
December 16, 2024

I don't think it can be done with a datepicker as the calendar has no state for the individual days.

You maybe could use this widget, https://github.com/thingworx-field-work/CalendarWidgetTWX/releases/tag/2.0.1

 

4-Participant
December 17, 2024

I appreciate you sharing your insights! I have a question regarding the calendar widget you mentioned. Is it a custom-made widget? Also, could you provide the guidelines for its usage? I'm eager to know if I can integrate it into my project and what steps I should take, especially since I'm still learning the ropes.

Rocko
19-Tanzanite
December 17, 2024

It's a custom-made widget by one of PTC's field engineers. As such, it is not directly supported and comes as it is, but you're free to change and/or extend it to your needs. I don't have a lot of experience with it but basically you would have a service returning an infotable of dates and status, which you bind the the calendar widget. Then you would use the "EventStates" property to configure the look and feel depending on the state (which could be "allowed" and "not allowed"). There is also a clickevent to see which date was clicked.

Maybe with CSS you can also make the "not allowed" not only gray, but also unclickable. You have to play around a bit to see what is possible.

16-Pearl
December 17, 2024

Another idea would be to use a Dropdown widget and add the dates there. This is for sure not very comfortable - depending on the amount of dates.