Recent Weblogs

Links I like

Next

CalendarSelect, an extension of GridBuild

So we finally get into a working implementation of a GridBase class. The CalendarSelect class is the first class that actually has a constructor and builds anything.

In the end of all of this is the implementation of a date chooser. In my search for an adaptable approach to a date chooser I found that everyone had just hopped right into implementation. None of the code could be reused for any other purpose. I wanted to take my time and build things up slowly so that any class could be extended to make very different variations.

The Skeleton gets its Strings

As you'll quickly notice, there is no interface for displaying the month or year. I've seeded the object to represent December 2020. The subclass of this one will account for those interface convienences. Read more about the subclass, DateSelect

Properties Table

CalendarSelect
Constructor
  initialize(Id/Element, options)
Receives an id or element to build the grid inside, secondary parameter is an options hash. Default options : { weekLength : 7, endWeek : 6, date : new Date()}.
Methods
Date[][]buildCalendarDTO(range)
Receives a range object of dates and formats them into a two dimensional array of date objects, prime for inserting into the grid. Fills in days before the 1st with "undefined".
Events
Datedayclick
Occurs when an object populated with Date information is clicked.

Comments are Disabled.