dolibarr-dev
[Top][All Lists]
Advanced

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

Re: [Dolibarr-dev] PErformance issue with Autocomplete combobox


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

What do you mean by "Using a dev like we did for product should be the solution" using ajax_autocompleter ?


Florian HENRY
address@hidden
+33 6 03 76 48 07
http://www.open-concept.pro
Twitter : @_Open_Concept_
Secretaire de l'association Dolibarr
Le 30/10/2013 11:25, Destailleur Laurent a écrit :
Yes, the combobox is an easy way to have autocompletion without developing ajax pages but it must be restricted to limited list. So for contacts it is not a good choice. Using a dev like we did for product should be the solution.

Waiting for that, did you try with chrome ? For such problem, it is really faster than firefox



2013/10/30 Florian Henry <address@hidden>
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


_______________________________________________
Dolibarr-dev mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev




_______________________________________________
Dolibarr-dev mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev


reply via email to

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