Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-6036

Return <strong> tag for Autocomplete Dropdown highlight

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Trunk
    • Fix Version/s: 14.12.01, 16.11.01
    • Component/s: framework
    • Labels:
      None

      Description

      I got the highlight text like <strong>US</strong> for Autocomplete Dropdown. See http://demo-trunk-ofbiz.apache.org/example/control/FormWidgetExamples

        Activity

        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        This is due to http://svn.apache.org/viewvc?view=revision&revision=1559769 ie the last major update of jQuery and related done 1 year ago.

        We will need to have a fresh look at this, at least we know it comes from jQuery stuff...

        Show
        jacques.le.roux Jacques Le Roux added a comment - This is due to http://svn.apache.org/viewvc?view=revision&revision=1559769 ie the last major update of jQuery and related done 1 year ago. We will need to have a fresh look at this, at least we know it comes from jQuery stuff...
        Hide
        jacques.le.roux Jacques Le Roux added a comment - - edited

        A possible fix is this

        Index: framework/images/webapp/images/selectall.js
        ===================================================================
        --- framework/images/webapp/images/selectall.js	(revision 1656366)
        +++ framework/images/webapp/images/selectall.js	(working copy)
        @@ -519,12 +519,7 @@
                                     var text = jQuery( this ).text();
                                     if ( this.value && ( !request.term || matcher.test(text) ) )
                                         return {
        -                                    label: text.replace(
        -                                        new RegExp(
        -                                            "(?![^&;]+;)(?!<[^<>]*)(" +
        -                                            jQuery.ui.autocomplete.escapeRegex(request.term) +
        -                                            ")(?![^<>]*>)(?![^&;]+;)", "gi"
        -                                        ), "<strong>$1</strong>" ),
        +                                    label: text,
                                             value: text,
                                             option: this
                                         };
        

        But

        1. we still loose the "Show All Items" button. To be checked also
        2. I guess we can do better, but not tonight for me...
        Show
        jacques.le.roux Jacques Le Roux added a comment - - edited A possible fix is this Index: framework/images/webapp/images/selectall.js =================================================================== --- framework/images/webapp/images/selectall.js (revision 1656366) +++ framework/images/webapp/images/selectall.js (working copy) @@ -519,12 +519,7 @@ var text = jQuery( this ).text(); if ( this .value && ( !request.term || matcher.test(text) ) ) return { - label: text.replace( - new RegExp( - "(?![^&;]+;)(?!<[^<>]*)(" + - jQuery.ui.autocomplete.escapeRegex(request.term) + - ")(?![^<>]*>)(?![^&;]+;)" , "gi" - ), "<strong>$1</strong>" ), + label: text, value: text, option: this }; But we still loose the "Show All Items" button. To be checked also I guess we can do better, but not tonight for me...
        Hide
        tzngvi Wei Zhang added a comment -

        see my fix below.

        Index: framework/images/webapp/images/selectall.js
        ===================================================================
        --- framework/images/webapp/images/selectall.js	(版本 1656378)
        +++ framework/images/webapp/images/selectall.js	(工作副本)
        @@ -524,7 +524,7 @@
                                                     "(?![^&;]+;)(?!<[^<>]*)(" +
                                                     jQuery.ui.autocomplete.escapeRegex(request.term) +
                                                     ")(?![^<>]*>)(?![^&;]+;)", "gi"
        -                                        ), "<strong>$1</strong>" ),
        +                                        ), "<b>$1</b>" ),
                                             value: text,
                                             option: this
                                         };
        @@ -558,7 +558,7 @@
                         })
                         //.addClass( "ui-widget ui-widget-content ui-corner-left" );
         
        -            input.data( "autocomplete" )._renderItem = function( ul, item ) {
        +            input.data( "ui-autocomplete" )._renderItem = function( ul, item ) {
                         return jQuery( "<li></li>" )
                             .data( "item.autocomplete", item )
                             .append( "<a>" + item.label + "</a>" )
        
        Show
        tzngvi Wei Zhang added a comment - see my fix below. Index: framework/images/webapp/images/selectall.js =================================================================== --- framework/images/webapp/images/selectall.js (版本 1656378) +++ framework/images/webapp/images/selectall.js (工作副本) @@ -524,7 +524,7 @@ "(?![^&;]+;)(?!<[^<>]*)(" + jQuery.ui.autocomplete.escapeRegex(request.term) + ")(?![^<>]*>)(?![^&;]+;)", "gi" - ), "<strong>$1</strong>" ), + ), "<b>$1</b>" ), value: text, option: this }; @@ -558,7 +558,7 @@ }) //.addClass( "ui-widget ui-widget-content ui-corner-left" ); - input.data( "autocomplete" )._renderItem = function( ul, item ) { + input.data( "ui-autocomplete" )._renderItem = function( ul, item ) { return jQuery( "<li></li>" ) .data( "item.autocomplete", item ) .append( "<a>" + item.label + "</a>" )
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Thanks Wei Zhang,

        Your patch is in
        trunk r1656445
        R14.12 r1656446

        Show
        jacques.le.roux Jacques Le Roux added a comment - Thanks Wei Zhang, Your patch is in trunk r1656445 R14.12 r1656446

          People

          • Assignee:
            jacques.le.roux Jacques Le Roux
            Reporter:
            tzngvi Wei Zhang
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development