Created
November 12, 2022 06:56
-
-
Save MikeTatsky/b5d08e0e4f0b05a80034c5b466874282 to your computer and use it in GitHub Desktop.
Sub search for combo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fancy.Combo.prototype.onSubSearchChange = function(field, value){ | |
var me = this, | |
lis = me.list.select('li'), | |
height = 0, | |
maxListHeight = me.listRowHeight * me.maxListRows; | |
value = value.toLocaleLowerCase(); | |
F.each(me.data, function(item, i){ | |
if (new RegExp(value).test(item[me.displayKey].toLocaleLowerCase())){ | |
lis.item(i).css('display', 'block'); | |
height += parseInt(lis.item(i).css('height')); | |
} | |
else{ | |
lis.item(i).css('display', 'none'); | |
} | |
}); | |
var listUl = me.list.select('ul').item(0); | |
if(height > maxListHeight){ | |
listUl.css('height', maxListHeight); | |
} | |
else{ | |
listUl.css('height', height); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment