I cant get to work properly with the example you gave , it always out of
scroll position after adding more than 1 item.

here is only working solution so far but very dirty.

If there any better solution?

qx.Class.define('phwabe.utils.list.InfiniList', {
  extend: qx.ui.list.List,

  members: {
    __deferredCall: null,
    __scrollBottom: false,
    __updateCount: 0,
    __resizeCount:0,

    _initLayer: function() {
      this.base(arguments);
      this._layer.addListener("updated", this._onUpdated, this);
      // this.getPane().addListener("update", this._scrollBottom, this)
    },

    _onUpdated: function(event) {
      if (this.__deferredCall === null) {
        this.__deferredCall = new qx.util.DeferredCall(function() {

          qx.ui.core.queue.Widget.add(this, 'updateSize');

        }, this);
      }
      this.__deferredCall.schedule();
    },
    _updateSize: function(callback) {
      var firstRow = this._layer.getFirstRow();
      var rowSize = this._layer.getRowSizes().length;
      // console.log(rowSize)
      for (var row = firstRow; row < firstRow + rowSize; row++) {
        var widget = this._layer.getRenderedCellWidget(row, 0);
        if (widget !== null) {
          var height = widget.getSizeHint().height;
          var current_height = this.getPane().getRowConfig().getItemSize(row);
          if (height !== current_height) {
            this.getPane().getRowConfig().setItemSize(row, height);
            console.log("resizing")

          }

        }

      }
      callback()
    },
    _scrollBottom: function(limit) {
      if (this.__scrollBottom === true) {
        this.getPane().setScrollY(1e99)
        this.scrollToY(1e99)
        var lastrow =  this.getModel().length -1;
        console.log(lastrow)
        this.getPane().scrollRowIntoView(lastrow)
        if (this.__updateCount >= limit) {
          this.__scrollBottom = false
        }

      }
    },
  syncWidget: function(jobs) {
    var that = this
    if (jobs.scrollBottom & jobs.updateSize) {
      console.log(jobs)
      this.__scrollBottom = true
      this.__updateCount = 0
      this._updateSize(function(){
        that._scrollBottom(6)
      })
      console.log("BOTH JOBS no of updates" + this.__updateCount)

      this.__updateCount += 1
    } else if (jobs.scrollBottom) {
      this.__scrollBottom = true
      this.__updateCount = 0
    } else if (jobs.updateSize) {
      this._updateSize(function(){
        that._scrollBottom(3)
      })
      this.__updateCount += 1
      console.log("no of updates" + this.__updateCount)
    }



  }
}
});

​

On Mon, Jun 22, 2015 at 2:11 AM, Phyo Arkar <phyo.arkarl...@gmail.com>
wrote:

> After trying to remember what my bugzilla pass , i had filed a bug.
> Bugzilla needs OAuth support badly.
>
>
>
> On Wed, Jun 17, 2015 at 9:29 PM, Phyo Arkar <phyo.arkarl...@gmail.com>
> wrote:
>
>> About disaapearing Scrollbars on Chrome? Ok i will file one.
>> It dosen't appear in my code tho.
>>
>> On Wed, Jun 17, 2015 at 8:55 PM, Mustafa Sak <mustafa....@1und1.de>
>> wrote:
>>
>>>  You are using Chrome right?
>>>
>>>
>>>
>>> Would you please report a bug?
>>>
>>>
>>>
>>> Dank & Gruß
>>> * Mustafa Sak*
>>>
>>> Softwareentwickler
>>> Mail Development
>>>
>>> 1&1 Mail & Media Development & Technology GmbH | Brauerstraße 48 | 76135
>>> Karlsruhe | Germany
>>> Phone: +49 721 91374-6977
>>> E-Mail: mustafa....@1und1.de | Web: www.1und1.de
>>>
>>>
>>>
>>> *Von:* Phyo Arkar [mailto:phyo.arkarl...@gmail.com]
>>> *Gesendet:* Mittwoch, 17. Juni 2015 10:51
>>> *An:* qooxdoo Development
>>> *Betreff:* Re: [qooxdoo-devel] How can i scroll to the end of a list ,
>>> after list item updated (continue), using dynamic virtual list widget sizes?
>>>
>>>
>>>
>>>   I can't see the scroll bar , it was hidden on purpose?
>>>
>>>
>>>
>>> On Wed, Jun 17, 2015 at 3:19 PM, Phyo Arkar <phyo.arkarl...@gmail.com>
>>> wrote:
>>>
>>> Thanks a lot for helping me out!
>>>
>>> When a singile last one is added its ok .
>>>
>>> When multiple LastOnes are added it dosen't scroll to bottom.
>>>
>>> Any thoughts?
>>>
>>>
>>>
>>> On Wed, Jun 17, 2015 at 1:47 PM, Mustafa Sak <mustafa....@1und1.de>
>>> wrote:
>>>
>>>   Wow,
>>>
>>>
>>>
>>> it was not so easy to solve that issue. But would you please try this
>>> example? http://tinyurl.com/nus7pev
>>>
>>>
>>>
>>> Dank & Gruß
>>> * Mustafa Sak*
>>>
>>> Softwareentwickler
>>> Mail Development
>>>
>>> 1&1 Mail & Media Development & Technology GmbH | Brauerstraße 48 | 76135
>>> Karlsruhe | Germany
>>> Phone: +49 721 91374-6977
>>> E-Mail: mustafa....@1und1.de | Web: www.1und1.de
>>>
>>>
>>>
>>> *Von:* Phyo Arkar [mailto:phyo.arkarl...@gmail.com]
>>> *Gesendet:* Montag, 15. Juni 2015 12:23
>>> *An:* qooxdoo-devel
>>> *Betreff:* [qooxdoo-devel] How can i scroll to the end of a list ,
>>> after list item updated (continue), using dynamic virtual list widget sizes?
>>>
>>>
>>>
>>> Previous thread was abandoned so i making new one , with more
>>> information.
>>>
>>> I am now using syncWidget to scroll to bottom of a virtual list when new
>>> item is added.
>>> But the problem is this virtuallist implementation automatically resizes
>>> list item height , and when scrolled inside syncWidget , it is not actually
>>> scrolled to the end , but to that widget item’s start.
>>>
>>> here is handler for list’s updates:
>>>
>>>       this.chat_list.getModel().addListener("change", function() {
>>>
>>>           // qx.ui.core.queue.Manager.flush();
>>>
>>>           qx.ui.core.queue.Widget.remove(this.chat_list,"scrollBottom");
>>>
>>>           // normally using the flush should be time enough for the renderer
>>>
>>>           qx.ui.core.queue.Widget.add(this.chat_list, "scrollBottom");
>>>
>>>       },this)
>>>
>>> I added a work around by counting how many times layer is updated , if
>>> it updated for 3 times , scrolls to button : 
>>> this._layer.addListener("updated",
>>> this._onUpdated, this); .
>>> Because i observed whenever a new item is added , layer firest updated 3
>>> times and only at the last time it need to actually scroll.
>>>
>>> Here is the infinite list with auto-resizing of item height from
>>> stackoverflow.com/questions/21456941/infinite-scroll-in-qooxdoo-with-virtual-list
>>> .
>>>
>>> qx.Class.define('phwabe.utils.list.InfiniList', {
>>>
>>>   extend: qx.ui.list.List,
>>>
>>>
>>>
>>>   members: {
>>>
>>>     __deferredCall: null,
>>>
>>>     __scrollBottom: false,
>>>
>>>     __updateCount: 0,
>>>
>>>
>>>
>>>     _initLayer: *function*() {
>>>
>>>       *this*.base(arguments);
>>>
>>>       console.log("initing layer")
>>>
>>>       *this*._layer.addListener("updated", *this*._onUpdated, *this*);
>>>
>>>     },
>>>
>>>
>>>
>>>     _onUpdated: *function*(event) {
>>>
>>>       *if* (*this*.__deferredCall === null) {
>>>
>>>         *this*.__deferredCall = *new* qx.util.DeferredCall(*function*() {
>>>
>>>
>>>
>>>           qx.ui.core.queue.Widget.add(*this*, 'updateSize');
>>>
>>>
>>>
>>>         }, *this*);
>>>
>>>       }
>>>
>>>       *this*.__deferredCall.schedule();
>>>
>>>     },
>>>
>>>     _updateSize: *function*() {
>>>
>>>       *var* firstRow = *this*._layer.getFirstRow();
>>>
>>>       *var* rowSize = *this*._layer.getRowSizes().length;
>>>
>>>       *for* (*var* row = firstRow; row < firstRow + rowSize; row++) {
>>>
>>>         *var* widget = *this*._layer.getRenderedCellWidget(row, 0);
>>>
>>>         *if* (widget !== null) {
>>>
>>>           *var* height = widget.getSizeHint().height;
>>>
>>>           *this*.getPane().getRowConfig().setItemSize(row, height);
>>>
>>>         }
>>>
>>>
>>>
>>>       }
>>>
>>>     },
>>>
>>>     _scrollBottom: *function*(limit) {
>>>
>>>       *if* (*this*.__scrollBottom === true) {
>>>
>>>         *this*.scrollToY(1e99)
>>>
>>>         *if* (*this*.__updateCount >= limit) {
>>>
>>>           *this*.__scrollBottom = false
>>>
>>>         }
>>>
>>>
>>>
>>>       }
>>>
>>>     },
>>>
>>>     syncWidget: *function*(jobs) {
>>>
>>>       *if* (jobs.scrollBottom & jobs.updateSize) {
>>>
>>>         console.log(jobs)
>>>
>>>         *this*.__scrollBottom = true
>>>
>>>         *this*.__updateCount = 0
>>>
>>>         *this*._updateSize()
>>>
>>>         *this*._scrollBottom(5)
>>>
>>>         console.log("BOTH JOBS no of updates" + *this*.__updateCount)
>>>
>>>
>>>
>>>         *this*.__updateCount += 1
>>>
>>>       } *else* *if* (jobs.scrollBottom) {
>>>
>>>         *this*.__scrollBottom = true
>>>
>>>         *this*.__updateCount = 0
>>>
>>>       } *else* *if* (jobs.updateSize) {
>>>
>>>         *this*._updateSize()
>>>
>>>         *this*._scrollBottom(3)
>>>
>>>         *this*.__updateCount += 1
>>>
>>>         console.log("no of updates" + *this*.__updateCount)
>>>
>>>       }
>>>
>>>
>>>
>>>     }
>>>
>>>   }
>>>
>>> });
>>>
>>>  ​
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> qooxdoo-devel mailing list
>>> qooxdoo-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>>
>>>
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> qooxdoo-devel mailing list
>>> qooxdoo-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>>
>>>
>>
>
------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to