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
florian.he...@open-concept.pro
+33 6 03 76 48 07
http://www.open-concept.pro
Twitter : @_Open_Concept_
Secretaire de l'association Dolibarr
_______________________________________________
Dolibarr-dev mailing list
Dolibarr-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev