Hi Skar,

On Tue, 6 Oct 2009, skar wrote:

> Fritz Zaucker wrote:

>> On Tue, 6 Oct 2009, skar wrote:
>>
>> 
>>> I'm using the smart table for search as type. When I receive more than
>>> zero rows, there is no problem. However, when I get empty(zero rows)
>>> result, I can't setData with an empty array due to the check at
>>> source/class/smart/Smart.js" line 1273.
>>> 
>> 
>> can you try
>>
>>     setData([[]]);
>> 
>> for the moment?
>> 
>
> I get the following error if I try the above:
>
>> TypeError: rowdata[this.buildarg.search_col[i]] is undefined

Ok, I almost expected something like that ...

>>> Any idea on how to work around this?  Basically, setData expects at least
>>> 1 row in the passed data array.  I couldn't find any resetData method, so
>>> don't know how to empty the table.
>>> 
>> 
>> I didn't think about the problem of "emptying" the table when I added this
>> check. My idea was to enforce a valid parameter (array of arrays).
>> 
>> I'll think about it a bit more ...
> 
> The first check should be if length is greater than zero, else return 
> immediately.

Well, the API says that it expects an [][] ... that's what the current check
enforces. May be, the length check could be added to that.

On the other hand, one could also allow a NULL parameter and use that for
resetting.

But I think this should actually be consistent through all table models and
thus be decided by the Qooxdoo-gods ...

> Or have a special resetData function so that the user can call it when
> there are no rows to set.

This would seem like the cleanest solution.

> Also, how much faster Smart Table is, instead of searching for the string
> in the row data and then using the matched rows in a separate array for
> the table model?

I don't know. I am not even sure it is faster (although I would assume that
it should be faster as it doesn't have to copy data) and it uses less memory
(no copy of data).

I just found SmartTableModel very elegant for implementing search as you
type.

>> How does it behave in the simple model? You should be able to reset with
>> table.clearSelection()
>> 
> Thanks, that did the job for me :)

Welcome.

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

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to