dolibarr-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dolibarr-dev] PErformance issue with Autocomplete combobox


From: Florian Henry
Subject: [Dolibarr-dev] PErformance issue with Autocomplete combobox
Date: Wed, 30 Oct 2013 10:40:42 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0

Hi all,

I'm experenting a real performance issue with jquery comobox (thridparty and contact) I've a data base with more than 20 000 contact, if I click on the arrow to display all contact, firefox freeze and put me a message "too long execution script continue or stop". I can continue but this is really bad user experience. I try to find a solution over internet.

For the search engine I found a piece of code and update core/lib/lib_head.js.
    In _create: function() {
        replace

var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" ); /response( select.children( "option:enabled" ).map(function() {
                            var text = $( this ).text();
if ( this.value && ( !request.term || matcher.test(text) ) )
                                return {
                                    label: text.replace(
                                        new RegExp(
"(?![^&;]+;)(?!<[^<>]*)(" +
$.ui.autocomplete.escapeRegex(request.term) +
")(?![^<>]*>)(?![^&;]+;)", "gi"
                                        ), "<strong>$1</strong>" ),
                                    value: text,
                                    option: this
                                };
                        }) );

By

var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
                        var select_el = select.get(0); // get dom element
                        var rep = new Array(); // response array
                        // simple loop for the options
                        for (var i = 0; i < select_el.length; i++) {
                            var text = select_el.options[i].text;
if ( select_el.options[i].value && ( !request.term || matcher.test(text) ) )
                                // add element to result array
                                rep.push({
                                    label: text.replace(
                                        new RegExp(
"(?![^&;]+;)(?!<[^<>]*)(" +
$.ui.autocomplete.escapeRegex(request.term) +
")(?![^<>]*>)(?![^&;]+;)", "gi"
                                        ), "<strong>$1</strong>" ),
                                    value: text,
                                    option: select_el.options[i]
                                });
                        }
                        // send response
                        response( rep );

It improve perf to 20% on render search. But the problem of down arrow click is still here.

Here my question :

1-At this time it's mostly a client side issue, but do you already experience this type of issue ? How did you solve it ?

--
Florian HENRY
address@hidden
+33 6 03 76 48 07
http://www.open-concept.pro
Twitter : @_Open_Concept_
Secretaire de l'association Dolibarr




reply via email to

[Prev in Thread] Current Thread [Next in Thread]