actionscript 3 - Use array as a dataProvider to populate DataGrid not working AS3 -
var lista:datagrid = new datagrid(); var tablaarray:array = new array(); var externalfile:urlrequest = new urlrequest("https://las.api.pvp.net/api/lol/las/v1.4/summoner/by-name/goncyrlz?api_key=mykey"); var textloader:urlloader = new urlloader(externalfile); lista.columns = ["id","name","profileiconid","summonerlevel","revisiondate"]; lista.setsize(stage.stagewidth, stage.stageheight); lista.x = 0; lista.y = 0; textloader.addeventlistener(event.complete, agregar); function agregar(event:event):void { var textocargado:string = textloader.data; tablaarray = textocargado.split(","); trace(tablaarray.tostring()); lista.dataprovider = new dataprovider(tablaarray); addchild(lista); }
the response on trace is:
{"goncyrlz":{"id":96893,"name":"goncyrlz","profileiconid":590,"summonerlevel":30,"revisiondate":1402143493000}}
but datagrid empty (but 5 rows), why it's this?
{"goncyrlz":{"id":96893,"name":"goncyrlz","profileiconid":590,"summonerlevel":30,"revisiondate":1402143493000}}
is single item object tablaarray.goncyrlz = {"id":96893,"name":"goncyrlz","profileiconid":590,"summonerlevel":30,"revisiondate":1402143493000}
try lista.dataprovider = new dataprovider(tablaarray.goncyrlz);
Comments
Post a Comment