0

I have an ExtJS datepicker where I disable some dates so the user can't select them.

After the calendar is renderer I send to the server the current date and the server sends back an array of days to disable, so the visual result is the following:

enter image description here

The problem I have is that I don't know the first and last day showed in the datepicker.

In this image the first day is 08/31/2014 and the last day is 09/11/2014. How can I get those dates, so I can tell my server to check if within that range I have to disable any date.

In the calendar example the "yellow marked dates" have to been disabled.

enter image description here

Any clue? Appreciate in advance.

VAAA
  • 14,531
  • 28
  • 130
  • 253

2 Answers2

1

Check this fiddle: https://fiddle.sencha.com/#fiddle/8ms

this uses minDate, maxDate with disabledDates, disabledDays combination..to enable particular days and disable all other days.

newmount
  • 1,921
  • 1
  • 12
  • 10
1

You could arbitrarily set the minValue to this month's first day and maxValueto this month's last day and then assume this on the backend side.

http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.field.Date-cfg-minValue

Here's how to get current month's first and last day

Get first and last date of current month with javascript or jquery

Community
  • 1
  • 1
Francis Ducharme
  • 4,848
  • 6
  • 43
  • 81