Hi Sak,

On Mon, 14 Sep 2009, Mustafa Sak wrote:

> I want to implement a "SearchAsYouType" function into my project like in
> the Demo. Just the Demobrowser uses a list object as controller. But I
> want to use some virtual tree or a table, because I am loading a huge
> amount of data and I need more columns than one.

> I tried to use filtered tables, but with addRegex() I just drop rows
> away. And addNotRegex() doesn't work in 0.8.2 anyway. I know about the
> smart table contrib., but its not documented.

addNotRegex() did work for me, but was just way too slow with any
substantial amount of data (>50 lines or so).

I am using a "brute-force" filter at the moment, something along the
following outline:

this.tableModel = new qx.ui.table.model.Simple();
this.data = [some array holding the data]; // can be multidimensional
var filter = qx.ui.form.TextField();
filter.addListener('input', function(e) {
     var searchVal = e.getData().toLowerCase();
     if (searchVal == undefined || searchVal == null || searchVal == '') {
         return;
     }
     var dataFiltered = [];
     var i, dataStr;
     var len = this.data.length;
     for (i=0; i<len; i++) {
          dataStr = this.data[i][1].toLowerCase(); // filtering on col 1 of a
                                                   // 2-dimensional array
          if (dataStr.indexOf(searchVal) != -1) {
              dataFiltered.push(this.data[i]);
          }
      }
      this.tableModel.setData(dataFiltered);
}, this);

Could be improved, of course (no need to filter all the data again on the
2nd, 3rd, ... character; perhaps a timer based timeout for starting the
filtering). But is faster than I can type for several thousands of lines in
my case.

Your mileage might vary ...

Cheers,
Fritz

-- 
Oetiker+Partner AG              tel: +41 62 775 99 03 (direct)
Fritz Zaucker                        +41 62 775 99 00 (switch board)
Aarweg 15                            +41 79 675 06 30 (mobile)
CH-4600 Olten                   fax: +41 62 775 99 05
Schweiz                         web: www.oetiker.ch

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to