Created
April 14, 2014 18:35
-
-
Save guisjlender/10672382 to your computer and use it in GitHub Desktop.
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
protected function refreshData():void | |
{ | |
for(var i:int=0;i<_arvoreCorporativaCaminhoes.length;i++) | |
{ | |
_arvoreCorporativaCaminhoes[i].children = new ArrayCollection(_arvoreCorporativaCaminhoes[i].children.source); | |
refreshRecursiveChildren(_arvoreCorporativaCaminhoes.source[i]); | |
} | |
tr.dataProvider = _arvoreCorporativaCaminhoes; | |
} | |
private function refreshRecursiveChildren(obj:Object):void | |
{ | |
if(obj.children) | |
{ | |
for each(var o:Object in obj.children.source) | |
{ | |
refreshRecursiveChildren(o); | |
} | |
obj.children = new ArrayCollection(obj.children.source); | |
obj.children.filterFunction = filterData; | |
obj.children.refresh(); | |
} | |
} | |
public function filterData(i:Object):Boolean | |
{ | |
var searchString:String = txtFiltro.text; | |
if(searchString.length == 0 | |
|| i.descricao.toLowerCase().indexOf(searchString.toLowerCase()) >= 0) | |
{ | |
return true; | |
} | |
else if(i.children != null && i.children.length > 0) | |
{ | |
return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment