Dvije zanimljive funkcije

Čisto onako da bacim kost da se imate oko čega prepirati malo :slight_smile:

Ali baš su mi genijalne ove funkcijice, ne vjerujem da se nisam toga ranije sjetio. :slight_smile:
Works like a charm…

function each_child(childList, funkc, f, sys){

	if(!f)var f={};
	var childsAttribute = f.childsAttribute || "childs" //target to childrens

	if(!sys)var sys={};
	var level = sys.level || 0;

	each(childList,function(child){
		funkc(child, level);
		if(child[childsAttribute]) each_child(child[childsAttribute], funkc,f, {level:level+1});
	});
}

function each_child_select(childList, funkc, f){

	if(!f)var f={};
	var send = [];

	each_child(childList, function(child, level){
		var r = funkc(child, level);
		if(r!==undefined)send.push(r);
	},f);

	return send;
}


Copyright © 2020 WM Forum - AboutContact - Sponsored by: Mydataknox & Webmaster.Ninja