Hey,

after digging deeper into qooxdoo for some months I now got a confusing
problem when using custom property events. I think it's a real trivial thing
but somehow I can't find my mistake...

That's my class:

[code]
qx.Class.define("fbpm.ui.app.selection.ResultMetaColumns",
{
  extend : qx.ui.container.Composite,

  construct : function(requestData)
  {
    this.base(arguments);
    this.setRequestData(requestData);
    this.__filterTimers = {};
[...]
  },

  properties :
  {
[...]
        columnFilters :
        {
          check     : "Object",
          nullable  : false,
          event         : "filtersChanged",
          apply         : "onFiltersChanged",
          init          : {}
        }
  },

  members :
  {
    __filterTimers : null,
    
    [...]

    start : function() {
    
this.fixedPaneWidgets[col][16].addListener("input",this._changeFilters,this);
       [...]
    },

    _changeFilters : function(e) {
      if(e.getType()=="input") {
        var target = e.getTarget();
        if(this.__filterTimers[targetFilter.col]==undefined ||
this.__filterTimers[targetFilter.col].classname != "qx.event.Timer") {
          this.__filterTimers[targetFilter.col] = new qx.event.Timer(1500);
         
this.__filterTimers[targetFilter.col].addListener("interval",function(e) {
            this.debug("interval reached...");
                currentFilters[targetFilter.col] = {
                  "type" : "contains",
                  "value" : target.getValue()
                };
                this.setColumnFilters(currentFilters);
                this.__filterTimers[targetFilter.col].stop();
          },this);
        }
        // sonst Timer neu starten
        else {
          this.debug("restarting...");
          this.__filterTimers[targetFilter.col].restart();
        }
      }
    },

    onFiltersChanged : function(old,value) {
          alert("done");
          qx.dev.Debug.debugObject(this.getColumnFilters());
    }
  }
});
[/code]

The event listen's for a changeValue of a TextField. The timer is used to
only apply the filter (by using a remote.Request which I removed for
testing) when the user stays idle for 1.5 seconds.
Now, when the user enters something into the TextField, the timer is started
(I see the debug output in FireBug console). When he continues typing the
timer is restarted correctly. When he now waits for 1.5 seconds the
setColumnFilters()-method is called and the onFiltersChanged()-method is
called either. So far - so good. When one now again starts typing I see the
timer is restarted and everything works fine. After staying idle again, the
setter is called but the apply method is not executed.

I think I've used constructions like this a hundred times before when using
QooxDoo, but somehow I can't find any mistake with this... Hope I'm just
blinded by QD and too many time spent over JavaScript code... ;-)

Thanks in advance,
Daniel
-- 
View this message in context: 
http://n2.nabble.com/using-timers-custom-property-events-tp4629009p4629009.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to