Hi Mustafa,

as I already said it's hard to reproduce in the playground... Especially, if
you don't have control over the backend ;)

But I tried. And I think I've found a test-case to reproduce the issue.
(unfortunately I can't provide a "shortened URL", cause our Network here
behaves evil...)
Anyway... with the attached code (to be run at
http://demo.qooxdoo.org/devel/playground/index.html) you should be able to
reproduce the issue.
Function:
- Each time you click on reload, the reloadData() method is called.
- Due to the fact that I haven't any control over the backend, I alter the
  "getRowCount" RPC-result every 2nd time (alternating returning 1000 or 500).
Result:
- You will see that the row-count indication will change, but the rendered data
  still displays the old data (it should display a 'newer' date)
Expected Result:
- You should see that the row-count indication will change, *AND* the rendered
  data displays the new data (it displays 'newer' dates)


Regards,
  Peter


On 1/21/2013 6:37 PM Mustafa Sak wrote:
> Can you please provide us with an example, like in demobrowser[1]? 
> 
> Please build it against current master.
> 
> Thanks
> Mustafa Sak
> 
> 
> [1] 
> http://demo.qooxdoo.org/devel/demobrowser/index.html#table~Table_Remote_Model.html
> 
> Applications & Integration
> 
> 1&1 Internet AG
> Ernst-Frey-Straße 10
> DE-76135 Karlsruhe
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Peter Schneider [mailto:[email protected]] 
> Gesendet: Montag, 21. Januar 2013 17:28
> An: qooxdoo Development
> Cc: Mustafa Sak
> Betreff: Re: qx.ui.table.model.Remote::reloadData() issue in 1.2.x branch
> 
> Hello Mustafa,
> 
> thanks for the input, but I don't like "picking randomly from trunk/master", 
> 'cause that would definitely introduce a randomness to the stability of my 
> application ;)
> 
> Although it still isn't guaranteed that a branch is any better than 
> trunk/master, I tend to think that
> * "tags" are most stable,
> * "branch"es are a bit less stable but needed for FIXES,
> * "trunk/master" is 'only for the brave' ;)
> 
> O.K. Back to topic:
> I see that the master looks exactly like the branch I've checked out. So the 
> error occurs with a master-checkout as well! When I revert the changes of 
> master:d4cd43114dcd6ee22346aa3778a170973c231448, My application behaves well 
> again. It might not be optimal for other cases, but the "fix" for Bug#7111 
> definitely introduces a regression here.
> 
> Thanks so far,
>  Peter
> 
> 
> On 1/21/2013 3:28 PM Mustafa Sak wrote:
>> Hi Peter,
>>
>> the last changes are made to master, because we have to write some 
>> unit test. So please try your code against master 
>> ba147769cf924ef3ae8c45c5ef4057be2b352474
>>
>> regards
>> Mustafa Sak
>>
>> Applications & Integration
>>
>> 1&1 Internet AG
>> Ernst-Frey-Straße 10
>> DE-76135 Karlsruhe
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Peter Schneider [mailto:[email protected]]
>> Gesendet: Montag, 21. Januar 2013 15:01
>> An: qooxdoo Development
>> Betreff: [qooxdoo-devel] qx.ui.table.model.Remote::reloadData() issue 
>> in 1.2.x branch
>>
>> Hi there,
>>
>> I've come along an issue with the remote table models reloadData() method.
>>
>> It seems to me that the row count is requested (from backend) and updated, 
>> but the (requested and received) row data will not be re-rendered!
>> The Table still shows the "old" data!
>> In my case the row count is reduced due to an applied filter. As an example:
>> a) 1000 rows (containing odd and even numbers)
>> b) Apply filter (only odd) + reloadData() => Table info-bar shows that 
>> getRowCount received 500 (OK) => Table Scroll-bar indicates that only 500 
>> rows should be shown (OK) but NO getRowData RPC and NO re-rendering of the 
>> current 'view-port'.
>>
>> Only if I e.g. change the order of one Column, a getRowData RPC call is done 
>> and the result is like expected.
>>
>> I have the suspicion, that the last change for Bug#7111[1] did introduce 
>> this issue.
>> Could it be that the move of the "this._clearCache = true;" line @ 
>> reloadData is not correct?
>>
>> I've tried to create a playground example for this, but I didn't succeed...A 
>> real backend might be needed to reproduce the issue.
>>
>> Any help/insight would be highly appreciated,
>>
>> Regards,
>>   Peter
>>
>> ---
>> [1] http://bugzilla.qooxdoo.org/show_bug.cgi?id=7111
qx.Class.define('demobrowser.demo.table.RemoteTableModel',
{
  extend : qx.ui.table.model.Remote,

  construct : function() {
    this.base(arguments);
    this.setColumns(["Id","Text"],["id","text"]);
  },

  members : {
    __odd : false, // 'toggle' member

    _loadRowCount : function () {
      var param = "method=getRowCount";
      this.__call(param, function(data) {
        var cnt = parseInt(data, 10);
        if (this.__odd) { cnt = cnt /2; }
        this.__odd = !this.__odd;
        this._onRowCountLoaded(cnt);
      });
    },


    _loadRowData : function (firstRow, lastRow) {
      var param = "method=getRowData&start=" + firstRow + "&end=" + lastRow;
      this.__call(param, function(data) {
        this._onRowDataLoaded(qx.lang.Json.parse(data));
      });
    },


    __call : function (param, callback) {
      var req = new qx.io.request.Xhr();
      var url = 
qx.util.ResourceManager.getInstance().toUri("http://demo.qooxdoo.org/devel/demobrowser/resource/demobrowser/backend/remote_table.php";);
      req.setUrl(url + "?" + param);
      req.addListener("success", function() {
        callback.call(this, req.getResponseText());
      }, this);
      req.send();
    }
  }
});


qx.Class.define("demobrowser.demo.table.TableDemo",
{
  extend : qx.application.Standalone,

  members :
  {
    __dlg : null,


    main : function ()
    {
      this.base(arguments);

      this._container = new qx.ui.window.Window(this.getCaption(), 
"icon/16/apps/office-spreadsheet.png").set({
        width: 600,
        height: 400,
        contentPadding : [ 0, 0, 0, 0 ],
        showClose: false,
        showMinimize: false
      });
      this._container.setLayout(new qx.ui.layout.VBox());
      this._container.open();

      this.getRoot().add(this._container, {left: 50, top: 10});

      this._table = this.createTable();
      this._controls = this.createControls();

      if (this._controls) {
        this._container.add(this._controls);
      }
      this._container.add(this._table, {flex: 1});

    },


    getCaption : function () {
      return "reloadData() check";
    },


    createTable: function ()
    {
      var tableModel = this._tableModel = new 
demobrowser.demo.table.RemoteTableModel();
      var custom = {
        tableColumnModel : function(obj) {
          return new qx.ui.table.columnmodel.Resize(obj);
        }
      };

      var table = new qx.ui.table.Table(tableModel,custom);
      var col = table.getTableColumnModel().getBehavior();
      col.setWidth(0,'10%');
      col.setWidth(1,'90%');

      return table;
    },


    createControls: function ()
    {
      var bar = new qx.ui.toolbar.ToolBar();
      var part = new qx.ui.toolbar.Part();
      bar.add(part);

      var reload = new qx.ui.toolbar.Button('Reload', 
"icon/22/actions/view-refresh.png");
      reload.addListener('execute',function(){
        this._tableModel.reloadData();
      }, this);
      part.add(reload);

      return bar;
    },


    showDialog : function (text)
    {
      if (!this.__dlg)
      {
        var dlg = this.__dlg = new qx.ui.window.Window().set({
          modal: true,
          showMinimize: false,
          showMaximize: false,
          width: 180,
          contentPadding: [10, 10, 10, 10]
        });
        dlg.moveTo(315, 100);

        var layout = new qx.ui.layout.Grid(15, 15);
        layout.setRowFlex(0, 1);
        layout.setColumnFlex(1, 1);
        dlg.setLayout(layout);

        dlg.add(
          new qx.ui.basic.Image("icon/32/status/dialog-information.png"),
          {row: 0, column: 0}
        );

        dlg.add(new qx.ui.basic.Label().set({
          rich: true,
          allowGrowY: true
        }), {row: 0, column: 1});

        var button = new qx.ui.form.Button("OK").set({
          alignX: "center",
          allowGrowX: false,
          padding: [2, 10]
        });
        button.addListener("execute", function(e) {
          dlg.close();
        }, this);
        dlg.add(button, {row: 1, column: 0, colSpan: 2});
      }

      this.__dlg.getChildren()[1].setValue(text);
      this.__dlg.open();
      this.__dlg.getChildren()[2].focus();
    }
  },


  destruct : function() {
    this._disposeObjects("_table", "_controls", "_container");
  }
});
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to