Type-Ahead Combo

ADJob mats at adjob.se
Fri Mar 20 02:09:25 EDT 2015


Hi.

> In $validate, why do you discard the event when iv_TEXT='' ?
> The problem with it is, that you cannot leave the field, click behind or close the window as long as you did not enter anything.
> It does not seem to be vital for the functionality(?)

You can do exceptions for certain events. But my point was only to check for a valid code before you leave the field.

But when and how you validates the data is a separate discussion. :-)

> In the past when I’ve done something like this I expected the user to enter a unique code, or the beginning of a unique code.  The app would process their entry and query the database accordingly.  If the user wanted to search the NAME (not the code) thy could enter N:abc,  or A:abc if they wanted to search on the address field.
> 
> This gave the user a choice of what they wanted to apply their search string on.
> If you wanted to implement this you would need to wait for a certain number of chars before executing your search, varying on whether the second character was a colon.
> 
> The other thing was assuming their text would always be at the beginning of a field… this way my SQL fetch would utilise indexes.  If the *user* wanted to search anywhere they could enter a wildcard character e.g. N:%abc  would search anywhere in the NAME column.
> 
> Just my 2 cents worth.  Would this add any value to your application Mischa / Mats / others ?
> 
> My concern about search the list of entries is that your list could be huge depending on the context.  A product list could have several thousand records in it.  If that’s fine, its fine, but I would be concerned about lists that size for performance reasons.  I would prefer to ask the db to do the searching.  Context is everything of course!  I’m not saying never search from lists.

The combo solution works for both. 

If the initial load of list takes just fractions of a second once, it will be way faster to filter the smartlist in memory. Otherwise I should choose db fetch.

The price for loading a smartlist at construct must be compared to speed enhancement when using. Using a combo within a complex grid will normally be a lot faster because you reuse the smartlist for every row.

I think it depends on your conditions which one you choose.

Speed is the king. I use both approaches.

FWIW,

/Mats







More information about the omnisdev-en mailing list