ui: remap manually instead of flushing for #1689

This commit is contained in:
Franco Fichtner 2018-02-27 10:18:45 +00:00
parent 40f95a7a91
commit 4e80fa931d

View File

@ -156,31 +156,22 @@ function updateServiceStatusUI(status) {
/**
* reformat all tokenizers on this document
*/
function formatTokenizersUI(){
// remove old tokenizers (if any)
$('div[class="tokenize Tokenize"]').each(function(){
$(this).remove();
});
$('select[class="tokenize"]').each(function(){
function formatTokenizersUI() {
$('select[class="tokenize"]').each(function () {
if ($(this).prop("size")==0) {
maxDropdownHeight=String(36*5)+"px"; // default number of items
} else {
number_of_items = $(this).prop("size");
maxDropdownHeight=String(36*number_of_items)+"px";
}
hint=$(this).data("hint");
width=$(this).data("width");
allownew=$(this).data("allownew");
nbDropdownElements=$(this).data("nbdropdownelements");
maxTokenContainerHeight=$(this).data("maxheight");
$(this).tokenize({
displayDropdownOnFocus: true,
newElements: allownew,
nbDropdownElements: nbDropdownElements,
placeholder:hint
});
$tokenizer = $(this).tokenize();
$tokenizer.resizeSearchInput();
$tokenizer.remap(true);
$tokenizer.updatePlaceholder();
$(this).parent().find('ul[class="TokensContainer"]').parent().css("width",width);
$(this).parent().find('ul[class="Dropdown"]').css("max-height", maxDropdownHeight);
if ( maxDropdownHeight != undefined ) {