I’ve a web application which returns a set of JSON Data to be displayed on graph. The user can toggle the graph by choosing date from JQUERY Calendar Control.
I need to disable the dates that are not being returned on JSON. Can someone please help me how I can achieve this?
e.g. JSON object could contain a data up to 1.5 years worth of data.
Thanks.
If you’re using the jQuery UI Datepicker, it takes optional min/max date parameters. From the documentation:
Restrict the range of selectable dates with the minDate and maxDate options. Set the beginning and end dates as actual dates (new Date(2009, 1 – 1, 26)), as a numeric offset from today (-20), or as a string of periods and units (‘+1M +10D’). For the last, use ‘D’ for days, ‘W’ for weeks, ‘M’ for months, or ‘Y’ for years.
So you would need determine your min/max dates from you json data, turn them into date objects, and pass them as options to the datepicker.