update ListCalendar

This commit is contained in:
rlx 2011-10-03 16:37:05 +00:00
parent d51de58009
commit a5a833f3c1
2 changed files with 24 additions and 13 deletions

View file

@ -9,15 +9,11 @@ Ox.ListCalendar = function(options, self) {
self = self || {}; self = self || {};
var that = Ox.Element({}, self) var that = Ox.Element({}, self)
.defaults({ .defaults({
addPlace: null, events: [],
editPlace: null,
height: 256, height: 256,
labels: false,
pageLength: 100, pageLength: 100,
places: null,
removePlace: null,
selected: [], selected: [],
sort: [{key: 'geoname', operator: '+'}], sort: [{key: 'name', operator: '+'}],
width: 256 width: 256
}) })
.options(options || {}) .options(options || {})
@ -172,14 +168,14 @@ Ox.ListCalendar = function(options, self) {
columnsRemovable: true, columnsRemovable: true,
columnsVisible: true, columnsVisible: true,
//items: Ox.clone(self.options.places), //items: Ox.clone(self.options.places),
items: self.options.places, items: self.options.events,
pageLength: self.options.pageLength, pageLength: self.options.pageLength,
scrollbarVisible: true, scrollbarVisible: true,
sort: self.options.sort sort: self.options.sort
}) })
.bindEvent({ .bindEvent({
'delete': removeItem, 'delete': removeItem,
init: initList, init: initList, // fixme: won't fire from static list
key_0: function() { key_0: function() {
self.$calendar.panToEvent(); self.$calendar.panToEvent();
}, },
@ -205,6 +201,11 @@ Ox.ListCalendar = function(options, self) {
self.$status = Ox.Element() self.$status = Ox.Element()
.css({paddingTop: '2px', margin: 'auto', fontSize: '9px', textAlign: 'center'}) .css({paddingTop: '2px', margin: 'auto', fontSize: '9px', textAlign: 'center'})
.html(
Ox.formatNumber(self.options.events.length) + ' Event' + (
self.options.events.length == 1 ? '' : 's'
)
)
.appendTo(self.$listStatusbar); .appendTo(self.$listStatusbar);
self.$calendar = Ox.Element(); self.$calendar = Ox.Element();
@ -214,7 +215,7 @@ Ox.ListCalendar = function(options, self) {
}); });
self.$placeForm = Ox.Form({ self.$placeForm = Ox.Form({
items: self.$placeFormItems, items: [],
width: 240 width: 240
}) })
.css({margin: '8px'}) .css({margin: '8px'})
@ -289,14 +290,22 @@ Ox.ListCalendar = function(options, self) {
); );
function initList() { function initList(data) {
self.$status.html(
Ox.formatNumber(data.items) + ' Event' + (
data.items == 1 ? '' : 's'
)
);
} }
function openItem() { function openItem() {
} }
function removeItem() {
}
function selectItem() { function selectItem() {
} }
@ -320,4 +329,6 @@ Ox.ListCalendar = function(options, self) {
}); });
} }
return that;
}; };