2013-08-16 2 views
0

У меня есть это приложение Я реализую новую версию popCalendar.js с, и я добавил функцию времени и даты zulu. Я не уверен, что у меня здесь не так. Я ударился головой о стену. Консоль дает мне это:Имея проблему с добавлением zulu времени и даты в popCalendar.js

Uncaught TypeError: Object #<Object> has no method 'popCalendar' 

Теперь страницы генерируются с библиотекой питона шаблонного и это фрагмент кода, который создает календарь:

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 я работал на:

http://snipt.org/AfNh5

Последний здесь образец 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" /> 

ответ

0

Я получил его :) Мне просто нужно zuluCalendar.show() вместо zuluCalendar.popCalendar() так:

<img src="images/calendar_icon.gif" style="float:left;" name="dateCalendarLink" value="images/calendar_icon.gif" class="Clickable hidePrint WEBlock" onclick="zuluCalendar.show(this, 'date', 'dd-mmm-yyyy')" id="dateCalendarLink" /> 
Смежные вопросы