0
我有這個應用程序我正在實施popCalendar.js的新版本,並且我添加了祖魯時間和日期功能。我不確定我在這裏有什麼問題。我一直把頭撞在牆上。控制檯使我這個:添加祖魯時間和日期到popCalendar.js的問題
Uncaught TypeError: Object #<Object> has no method 'popCalendar'
現在,頁面以一個Python模板庫中產生,這是創建日曆中的片段:
class DateField(TextField):
"""
A field with a date widget as the input (which provides a browseable way to select the date)
"""
properties = TextField.properties.copy()
Base.addChildProperties(properties, Display.Label, 'calendarTypeLabel')
properties['isZulu'] = {'action':'setIsZulu', 'type':'bool'}
properties['hideTypeLabel'] = {'action':'formatDisplay.call', 'name':'hide', 'type':'bool'}
properties['dateFormat'] = {'action':'classAttribute'}
def __init__(self, id, name=None, parent=None):
TextField.__init__(self, id, name, parent)
self.userInput.style['width'] = '7.5em'
self.dateFormat = "dd-mmm-yyyy"
layout = self.addChildElement(Layout.Horizontal())
layout.addClass("FieldDescription")
self.calendarLink = layout.addChildElement(Display.Image(id + "CalendarLink"))
self.calendarLink.addClass('Clickable')
self.calendarLink.addClass('hidePrint')
self.calendarLink.setValue('images/calendar_icon.gif')
self.calendarLink.addJavascriptEvent('onclick', CallBack(self, "jsOpenCalendar"))
self.calendarTypeLabel = layout.addChildElement(Display.Label())
self.calendarTypeLabel.style['margin-left'] = "4px;"
self.calendarTypeLabel.style['margin-right'] = "4px;"
self.calendarTypeLabel.style['display'] = "block;"
self.setIsZulu(False)
self.formatDisplay = layout.addChildElement(Display.Label())
self.connect('beforeToHtml', None, self, '__updateDisplay__')
def setIsZulu(self, isZulu):
"""
If set to true the calender will use the zulu date
"""
self.isZulu = isZulu
if isZulu:
self.calendarTypeLabel.setText("Z")
else:
self.calendarTypeLabel.setText("LCL")
def __updateDisplay__(self):
if not self.editable():
self.calendarLink.hide()
self.formatDisplay.setText(self.dateFormat)
def jsOpenCalendar(self):
"""
Returns the javascript that will open the calender clientside
"""
if self.isZulu:
calendarType = "zulu"
else:
calendarType = "lcl"
return ("%sCalendar.popCalendar(this, '%s', '%s')" %
(calendarType, self.userInput.fullId(), self.dateFormat))
Factory.addProduct(DateField)
這是我一直努力的popCalendar.js於:
上次來這裏是在我的應用程序的HTML樣本:
<img src="images/calendar_icon.gif" style="float:left;" name="dateCalendarLink" value="images/calendar_icon.gif" class="Clickable hidePrint WEBlock" onclick="zuluCalendar.popCalendar(this, 'date', 'dd-mmm-yyyy')" id="dateCalendarLink" />