Function Search


#1

Hello,
Actually i work on an organigram for my study,
And i don’t know how to create or use an function for search in your organigram. I use findAll, with css modifier for identify the shape but the problem is, find need exact word with case sensitive. So it’s not really user friendly
Thank you for your product, it’s very enjoyable to learn with him and sorry for my bad english (I am French).

My Function :
function find() {
var testin =document. formSearch.input.value;
var shapeALL = diagram.data.findAll({by:“text”,match:testin});
if(shapeALL == null){
document.getElementById(“Resultat_Search”).innerHTML =‘Resultat non trouvé’
}
else{
console.log(shapeALL);
var i = 0;
var textaffiche = “”;
while(shapeALL[i]){
//Ouverture de l’arborescence jusqu’a la shape initial
famille=shapeALL[i];
while(famille.parent != null){
diagram.expandItem(famille.parent);
famille=diagram.data.getItem(famille.parent);
console.log(shapeALL[i]);
diagram.data.update(shapeALL[i].id, {css:“myStyle”});
}
textaffiche = textaffiche + Shape - id:${shapeALL[i].id}, text:${shapeALL[i].text}, type:${shapeALL[i].type} + “\n”

			i++;
			}
			diagram.showItem(shapeALL[0].id);
			document.getElementById("Resultat_Search").innerHTML = textaffiche;
		}
	}