can't get model.setData to preserve sort order

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

can't get model.setData to preserve sort order

johnd
When I call setData on a model, it doesn't sort the new data.  I am
passing in false for the clearSorting param

this code shows what I mean.


qx.Class.define("tableexample.Application",
{
  extend : qx.application.Standalone,
  members :
  {
    model : null,
    COL_COUNT : 5,
    ROW_COUNT : 10,
    main : function()
    {
      this.base(arguments);
      var button1 = new qx.ui.form.Button("First Button",
"tableexample/test.png");
      var table = this.createTable();
      var doc = this.getRoot();
      var view = new qx.ui.splitpane.Pane('vertical');
      view.add(table,3);
      view.add(button1,1);
      doc.add(view,{edge: 0});
      var appCtx = this;
      button1.addListener("execute", function(e) {
        var rowData = appCtx.createRandomRows(appCtx.ROW_COUNT);
        appCtx.model.setData(rowData,false);
      });
    },

 createRandomRows: function(rowCount) {
      var rowData = [];
      for (var row = 0; row < rowCount; row++)
      {
        var row1 = [];
        for (var i = 0; i < this.COL_COUNT; i++) {
          row1.push("Cell " + i + "x" + row);
        }
        rowData.push(row1);
      }
      return rowData;
    },

    createTable: function() {
      var rowData = this.createRandomRows(this.ROW_COUNT);
      var tableModel = this._tableModel = new qx.ui.table.model.Simple();
      this.model=tableModel;
      var headers = [];

      for (var i = 0; i < this.COL_COUNT; i++) {
        headers.push("Column " + i);
      }
      tableModel.setColumns(headers);
      tableModel.setData(rowData);
      var table = new qx.ui.table.Table(tableModel);
      return table;
    }

  }
});

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel