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<mailto:mustafa....@1und1.de> | Web: 
www.1und1.de<http://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<http://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

Reply via email to