Results 1 to 2 of 2
  1.    #1  
    Hello and good morning,

    I tried to program a very little clock example but although that's probably supposed to be very trivial, I didn't made to update the clocks (which is actually a DatePicker) model.

    I will post the whole code since it's very short:

    So, here is the scene (which is pushed in the stage assistant of course):

    <div id="timepicker" x-mojo-element="TimePicker"></div>

    And this is the source from Picker-Assistant.jsjsjs:

    function PickerAssistant() {

    PickerAssistant.prototype.setup = function() {
    this.timepickerModel = { time : new Date(), disabled : false };

    this.attributes = {
    label: 'Time',
    modelProperty: 'time'


    setInterval(this.update(), 1000);

    PickerAssistant.prototype.update = function(){"updating...");
    this.timepickerModel.time = new Date();
    this.controller.modelChanged(this.timepickerModel, this);

    PickerAssistant.prototype.activate = function(event) {

    PickerAssistant.prototype.deactivate = function(event) {

    PickerAssistant.prototype.cleanup = function(event) {

    But all I get is this error as shown here:

    [20101221-07:18:04.388131] warning: WARNING: modelChanged() found no watchers. Did you call it with the ORIGINAL model object, and not a replacement?

    What am I doing wrong ?
    I found out that I could work around this error by using setWidgetModel(...) but I think this is not the way it should work ?!

    thank you for any comments ...have a nice day!
  2. #2  
    Two things look suspicious about the call to setInterval:

    1. By having parentheses on this.update(), it's calling the update method immediately, and the return value is what will be evaluated at each interval. If you leave off the parentheses, the method will be called at each interval, which I think is what you intended.

    2. You may need to use Prototype's bind() method to make sure the 'this' in 'this.update' is the correct instance of 'this.' I had to do so when I called setTimeout in my code, so it's probably the same case for setInterval.

    setInterval(this.update.bind(this), 1000);

Posting Permissions