Almost no is not none :)

Your code is absolutely correct and works perfectly. Please make sure that you have a Shell and a Body component on your page. In your case those would be included with your DemoBorder component, so have a look at that template. Also make sure that you don't include some css or javascript somewhere that might interfere with the suggest component. If you do include something try leaving it out.

Uli

Andy Pahne schrieb:


Ulrich Stärk schrieb:
 > This is the rendered code, could you please provide the corresponding
 > template and page class code?
 >




There's almost no difference beetwenn the source of the TimeTracker demo and mine:



<span jwcid="@DemoBorder">

<style type="text/css">
        div.autocomplete {
            position:absolute;
            width:250px;
            background-color:white;
            border:1px solid #888;
            margin:0px;
            padding:0px;
        }
        div.autocomplete ul {
            list-style-type:none;
            margin:0px;
            padding:0px;
        }
        div.autocomplete ul li.selected { background-color: #ffb;}
        div.autocomplete ul li {
            list-style-type:none;
            display:block;
            margin:0;
            padding:4px 0 4px 4px;
            cursor:pointer;
        }
div.autocomplete ul li img { border:none; margin-right: 10px; vertical-align:middle;}
</style>


<h2>Suggest Demo (Script.aculo.us)</h2>
<form jwcid="@Form" class="container">
    <table width="90%" class="form" cellpadding="2" cellspacing="0" >
        <tbody>
            <tr>
<td><label jwcid="@FieldLabel" field="component:suggest" /></td>
                <td><input jwcid="suggest" size="60" /></td>
            </tr>
        </tbody>
    </table>

</form>











    @Component(bindings = {"value=inputLocale",
            "displayName=literal:Locale",
            "listSource=localeList",
            "listener=listener:suggestLocale",
            "listItemRenderer=itemRenderer"})
    public abstract Suggest getSuggest();

    /**
     * listSource
     */
    public List<Locale> getLocaleList() {

        LOG.info("listSource was called");

        String filter = getFilterString();
        Locale[] locales = Locale.getAvailableLocales();

        if (filter == null || filter.length() < 1) {
            return Arrays.asList(locales);
        }

        filter = filter.toUpperCase();

        List<Locale> ret = new ArrayList<Locale>();
        // used to ensure no duplicates are stored in the list as
        // java.util.Locale doesn't
        // provde an equals() method.
        List<String> temp = new ArrayList<String>();

        for (Locale locale : locales) {
if (locale.getDisplayCountry().toUpperCase().indexOf(filter) > -1
                    && !temp.contains(locale.getDisplayCountry())) {
                ret.add(locale);
                temp.add(locale.getDisplayCountry());
            }
        }

        LOG.info("List contains " + ret.size() + " items, filter is '"
            + getFilterString() + "'");
        return ret;
    }

    /**
     * listener
     * <p>
* Invoked dynamically via XHR whenever input changes in the form input field. The method above - getLocaleList() - * is what actually filters the list of suggested options displayed based on the characters they typed in to the input field.
     */
    public void suggestLocale(String filter) {
        LOG.info("Suggest Listener was called. Filter is '"+filter+"'");
        setFilterString(filter);
    }

    /** value */
    public abstract String getInputLocale();

    public abstract String getFilterString();
    public abstract void setFilterString(String filter);

    static ListItemRenderer ITEM_RENDERER = new LocaleListItemRenderer();
    public ListItemRenderer getItemRenderer()
    {
        return ITEM_RENDERER;
    }




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to