Hi Fritz, thank you for your thorough analysis. We know that the filtered table model is not optimal. There are a couple of bugs to improve the performance of the model by removing unnecessary computations [1-3]. Recently Dave Baggett has proposed his "Smart" table model as replacement for the filtered table model [4]. Unfortunately we will not be able to fix these issues in the short term.
Best Fabian [1] <http://bugzilla.qooxdoo.org/show_bug.cgi?id=999> [2] <http://bugzilla.qooxdoo.org/show_bug.cgi?id=2431> [3] <http://bugzilla.qooxdoo.org/show_bug.cgi?id=790> [4] <http://bugzilla.qooxdoo.org/show_bug.cgi?id=2474> > Hi, > > with SVN-trunk checkout 19765: > > I am using qx.ui.table.model.Filtered.addRegex() with the following > observations: > > 1) The filter is executed immediately after the call to addRegex(), without > a call to applyFilters(). The API would suggest otherwise, which would > probably make sense performance wise if several filters are needed on the > same table model. > > 2) Calling addRegex() twice on the same column with different filter values > leads to replacement of the first filter. Which is fine for my current > application, but not what I would expect from the verb "add". > > At least it should be document. > > If addRegex() would indeed add (to a stack of) filters, I guess there > would be some need to explicitely remove a filter. > > 3) addRegex() works also exactly the same as described above with a simple > table model (which according to the API it should not). > > 4) The naming of the addFilter functions is inconsistent. Shouldn't it be > addRegexFilter() and addNotRegexFilter() ? > > 5) Feature request: a function addSubstringFilter() would be useful with > substring matching instead of Regex matching, e.g. when working with a > SQL backend that might not support Regexes. > > Here is a code snippet which should reproduce the above behaviour: > > var tableModel = new qx.ui.table.model.Simple(); > // var tableModel = new qx.ui.table.model.Filtered(); > tableModel.setColumns([ this.tr("Location"), > this.tr("Team"), > this.tr("Client"), > this.tr("User") > ], // headers > ['location', 'team', 'client', 'user'] //IDs > ); > // Customize the table column model. We want one that automatically > // resizes columns. > var custom = { > tableColumnModel : function(obj) { > return new qx.ui.table.columnmodel.Resize(obj); > } > }; > > var outputTable = new qx.ui.table.Table(tableModel, custom); > with (outputTable) { > set({ padding: 0, > showCellFocusIndicator: false, > keepFirstVisibleRowComplete: true, > columnVisibilityButtonVisible: false, > statusBarVisible: false > }); > setMetaColumnCounts([1, -1]); > > getSelectionModel().setSelectionMode(qx.ui.table.selection.Model.MUL > TIPLE_INTERVAL_SELECTION); > > var tcm = getTableColumnModel(); > > // Obtain the behavior object to manipulate > var resizeBehavior = tcm.getBehavior(); > > // The default is { width:"1*" } so this one is not necessary: > resizeBehavior.set(0, { width:"1*"}); > resizeBehavior.set(1, { width:"1*" }); > resizeBehavior.set(2, { width:"1*"}); > resizeBehavior.set(3, { width:"1*" }); > }; > this.add(outputTable); > > var testData = [ > ['Olten', 'O+P', 'U12345', 'zaucker'], > ['Olten', 'O+P', 'U12345', 'oetiker'], > ['Bern', 'SCIS', 'U23456', 'lepore'], > ['Olten', 'O+P', 'U34567', 'plessl'], > ['Bern', 'SCIS', 'U45678', 'henning'], > ['Bern', 'SCIS', 'U56789', 'Frera'] > ]; > tableModel.setData(testData); > > this._filter = new qx.ui.form.Button(this.tr("Filter")); > > this._filter.addListener('execute',function (e) { > var location = 'Olten'; > var team = 'O+P'; > var client = null; > var user = null; > > if (location != null) { > tableModel.addRegex(location, 'location', true); //ignorecase > } > if (team != null) { > tableModel.addRegex(team, 'team', true); //ignorecase > } > if (client != null) { > tableModel.addRegex(client, 'client', true); //ignorecase > } > if (user != null) { > tableModel.addRegex(user, 'user', true); //ignorecase > } > // tableModel.applyFilters(); > }); > > Cheers, > Fritz > > -- Fabian Jakobs JavaScript Framework Developer 1&1 Internet AG - Web Technologies Ernst-Frey-Straße 9 · DE-76135 Karlsruhe Telefon: +49 721 91374-6784 fabian.jak...@1und1.de Amtsgericht Montabaur / HRB 6484 Vorstände: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Thomas Gottschlich, Robert Hoffmann, Markus Huhn, Hans-Henning Kettler, Dr. Oliver Mauss, Jan Oetjen Aufsichtsratsvorsitzender: Michael Scheeren ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel