Recent Weblogs

Links I like

Next

DateSelect, a Decoupled Chooser

Quite possibly my favorite flavor of the chooser. Much like the CalendarSelect, but with functionality of month traversal and a proper month and year display. This class greatly improves on the usability of CalendarSelect.

By utilizing the dayclick event, we can easily allow for date "choosing" functionality with just an instantiation of a DateSelect object. This free's the class from tending just one input object or whatever display object is sent to the constructor. I prefer to just use anonymous functions and access the DOM that way.

DateSelect
Constructor
DateSelectinitialize(HTMLElement, hash options)
Receives an HTML object or id to build into.
Methods
voidupdateTitle
Receives no arguments, sets the title bar, being the node that contains the month and year to the objects current month and year.
HTMLElement TR createControlBar
Returns a programatically created row object of a certain HTML Microformat. Row object with 3 cells, two of which bound with a click event to enable month traversal.
HTMLElement TR createHeader
Returns a table row object corresponding to the 7 days, sets up the days of the week row.
void rebuildTable(Date obj)
Receives a date object and rebuilds the table corresponding to that object.
void injectTable(HTMLElement TR)
Receives a row object and inserts it as the first element in the tbody.

Comments are Disabled.