You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Dariusz Wojtas (JIRA)" <ji...@apache.org> on 2006/12/16 23:36:57 UTC

[jira] Commented: (WW-1562) Autcompleter bugs\improvements

    [ http://issues.apache.org/struts/browse/WW-1562?page=comments#action_39116 ] 
            
Dariusz Wojtas commented on WW-1562:
------------------------------------

Here are my initial comments/wishes about the autocompleter:

a)
add tag attribute that will let the application control
when to load initial content.
For example
  loadAfterMinimum="3"
which could tell the tag to load the content after typing 
minimum 3 chars by the user.
Later, when somebody uses backspace - unload the content
if the number of entered chars is lower than 'loadAfterMinimum'.
Reason.
An example:
An application with 100 000 customers.
Operator needs to chose one of customets on his form.
Most obious choices for implementation are (there are others):
* provide extra window load/search/page and finally select customer
* the same done with modal dialog (paging/reloading may be tricky)
* use autocompleter in cases where the programmer knows it makes sense

For me the modal dialog would be the best option, but reloading/paging
makes it tricky to reload the modal panel and not the whole app.
therefore - autocompleter.
But with that amount of data (100 000 entries) it does not make sense to load it all immediately.

*** Some indicator could be given to the user why nothing is loaded ***
For example a 1 position combo saying "type minimum n characters"


b)
preselecting option using 'value' attribute.
This is definitely something needed also for dynamic data.
I think that this way usually we select 'parent' nodes in the database hierarchy. 
If the parent is selected somewhere, and is dropped by some reason long time later, 
then even all it's children will be deleted
[also the record using it with autocompleter]
In case of value representing a 'phantom' value - it may be prepared to
display a special option
  <no value in combo box>
(localizable)

In addition the options allowed static way (set with list) do not guarantee that
the content of this list do not change over time (add/remove). 
Applications are changing, the same way as options.


c) 
I am not 100% sure here (I had maven/eclipse caching issues 
in the past - now I believe these problems are gone) but my SVN trunk sources contain:
* generated TLD contains attribute 'delay', while the class contains 'searchDelay'
* TLD does not contain attribute  'searchType', while it is described in wiki 
 and defined in class


d)
the 'disabled' property (AutocompleterTag) overrides something defined 
in parent class (AbstractUITag). This may lead to issues, as setter
in autocompleter may leave the parent 'disabled' property unset.
To be dropped from autocompleter.
It is declared everywhere as protected - no problem with accessing it from parent class.

   
e)
is there any option to define the number of displayed options
if there are too many for display? Currently it seems to be hardcoded somewhere to
display only 30 of them (nice default).
It would be nice to make it configurable - which makes sense if the developer
changes the 'dropdownHeight'.
Add attribute: maxDisplayed, default 30


f)
add option to reload options while the text is typed and a property that controls 
the minimum delay before sending request for it to the server.
Maybe it could even be implemented by 1 property:
   reloadDelay="<millis>"
which means the delay before reloading AFTER A CHARACTER IS TYPED.
This delay count could be reset if another char is typed before it starts reload.



g)
add info somewhere (wiki) info if the options sent by the server to autocompleter 
may be compressed (if the browser says it is capable to handle gzip/deflate content).
I am pretty sure it is normal and allowed, but cannot be 100% sure as I do not know
how dojo interprets it. Most likely the browser decompresses it prior to giving it to dojo.

  

Improvements in javadoc/wiki:
-------------------
1)
The wiki page [http://cwiki.apache.org/confluence/display/S2WIKI/Ajax+Tags]
contains nice info that autocompleter accepts data in the JSON notation.
Can you add in bold to remember about escaping '\' and '"' characters?
The json main page nicely decribes the exact rules, but many developers
[I did it myself first] will not escape it - overlook.
It will work for them, but suddenly [depending on data from DB] it will stop displaying 
anything in the combo.

2)
Please add a short description of possibilities for defining autocompleter contents.
It is obvious that the property it represents is tied to a form property,
but the list of displayed values may be implemented both as:
 * a form member getter
 * a completely separate action (I prefer this one).
 *  ... ?
The problem in the 2nd case is that all properties of the parent form are appended
to the 'href' attribute as parameers and struts param interceptor complaints about unknown properties. 
I tried 'formId' and 'formFilter' settings
[sample for DIV in http://cwiki.apache.org/confluence/display/S2WIKI/Ajax+Tags]
but it did not work as expected for me.
More info in this topic would be helpful.
Example 'reusabe' lists across a tpical app: zip code, city

   
Other:
* 
[possible dojo issue]
I load a set of options [about 300] but the combo shows only 1st 30 of them.
I type some chars and the result is narrowed, then I press backspace but the shown
options do not seem to see that the preselect conditions were narrowed.
I used 
    forceValidOption="true"
if it helps. This does not seem to happen every time.
To reproduce it one needs to type enough characters to match 1 option only, 
and then start using backspace.

> Autcompleter bugs\improvements
> ------------------------------
>
>                 Key: WW-1562
>                 URL: http://issues.apache.org/struts/browse/WW-1562
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>    Affects Versions: 2.0.2
>            Reporter: Musachy Barroso
>            Priority: Minor
>
> * Provide ability to reload options while text is typed
> * Select previous value when page is reloaded

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira