Re: svn commit: r910587 - in /ofbiz/trunk/framework: common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy example/widget/example/FormWidgetExampleLookupScreens.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r910587 - in /ofbiz/trunk/framework: common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy example/widget/example/FormWidgetExampleLookupScreens.xml

Scott Gray-2
On 16/02/2010, at 9:42 AM, [hidden email] wrote:

> Author: erwan
> Date: Tue Feb 16 16:42:00 2010
> New Revision: 910587
>
> URL: http://svn.apache.org/viewvc?rev=910587&view=rev
> Log:
> The auto-completer (in lookup fields) default behavior is "%fieldValue%" (contains operation).
> This allows to change the behavior to "fieldValue%"(statrWith operation) when setting to "Y" the searchTypeStartWith field
>
> Modified:
>    ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy
>    ofbiz/trunk/framework/example/widget/example/FormWidgetExampleLookupScreens.xml
>
> Modified: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy?rev=910587&r1=910586&r2=910587&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy (original)
> +++ ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy Tue Feb 16 16:42:00 2010
> @@ -32,7 +32,10 @@
> displayFields = context.displayFields ?: searchFields;
> searchValueFieldName = parameters.searchValueField;
> fieldValue = parameters.get(searchValueFieldName);
> -
> +searchTypeStartWith = context.searchTypeStartWith;
> +if( searchTypeStartWith == null){
> +    searchTypeStartWith = "N";
> +}
> if (searchFields && fieldValue) {
>     searchFieldsList = StringUtil.toList(searchFields);
>     displayFieldsSet = StringUtil.toSet(displayFields);
> @@ -40,20 +43,26 @@
>     displayFieldsSet.add(returnField); //add it to select fields, in case it is missing
>     context.returnField = returnField;
>     context.displayFieldsSet = displayFieldsSet;
> -    searchFieldsList.each { fieldName ->
> -        andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue(fieldName)), EntityOperator.LIKE, "%" + fieldValue.toUpperCase() + "%"));
> +    if("Y".equals(searchTypeStartWith.toUpperCase())){
> +     searchValue = fieldValue.toUpperCase() + "%";
> +    }
> +    else{
> +     searchValue = "%" + fieldValue.toUpperCase() + "%";
> +    }
> +    searchFieldsList.each { fieldName ->
> +        andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue(fieldName)), EntityOperator.LIKE, searchValue));
>     }
> }
> -
> +System.out.println(andExprs);
Hi Erwan,

You've forgotten to remove your println statement.  
Also please watch your code formatting:
if (...) {
    ...
} else {
    ...
}

Thanks
Scott

smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r910587 - in /ofbiz/trunk/framework: common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy example/widget/example/FormWidgetExampleLookupScreens.xml

Erwan de FERRIERES

> Hi Erwan,
>
> You've forgotten to remove your println statement.
> Also please watch your code formatting:
> if (...) {
>      ...
> } else {
>      ...
> }
>
> Thanks
> Scott

Done at r910844. Thanks !!

--
Erwan de FERRIERES
www.nereide.biz
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r910587 - in /ofbiz/trunk/framework: common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy example/widget/example/FormWidgetExampleLookupScreens.xml

Scott Gray-2
Thanks Erwan!

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 17/02/2010, at 12:30 AM, Erwan de FERRIERES wrote:

>
>> Hi Erwan,
>>
>> You've forgotten to remove your println statement.
>> Also please watch your code formatting:
>> if (...) {
>>     ...
>> } else {
>>     ...
>> }
>>
>> Thanks
>> Scott
>
> Done at r910844. Thanks !!
>
> --
> Erwan de FERRIERES
> www.nereide.biz


smime.p7s (3K) Download Attachment