Groups | Blog | Home
all groups > flash (macromedia) > december 2006 >

flash (macromedia) : Problem controlling the appearance of DataGrid



TorIRislaa
12/6/2006 9:02:44 PM
Problem controlling the appearance of DataGrid

If I provide my DataGrid with data from an Array as below I have full control
of the appearance.

var myDP_array:Array = new Array();
myDP_array.push({Name:"Ted", Score:"1000"});
myDP_array.push({Name:"Bob", Score:"1250"});
myDP_array.push({Name:"Scott", Score:"25"});
dg_search.dataProvider = myDP_array;

dg_search.getColumnAt(0).width = 100;
dg_search.getColumnAt(1).textAlign = "right";
dg_search.vScrollPolicy = "off";
dg_search.showHeaders = false

?but if I provide my DataGrid with data from an XML file by using an
XMLConnector and a DataSet the lines just below works fine:

dg_search.vScrollPolicy = "off";
dg_search.showHeaders = false


?but these lines have no effect on my DataGrid:

dg_search.getColumnAt(0).width = 100;
dg_search.getColumnAt(1).textAlign = "right";


I load data into the DataGrid by using the code xmlConn.trigger();
The DataGrid is bound to myDataSet and all seems to work OK except that I
can?t control the appearance of the individual columns.

If anyone has any ideas on how to solve this problem I would like to hear
about it.

TIRislaa

Mark2450
3/28/2007 8:04:32 PM
I was having the same problem for a couple days and figured it out!

Apparently, when you call the XML file, it overrides the
[dg_search.getColumnAt(0).width = 100] command.
So I put the datagrid, all the setStyle commands, and the XML call on the
first frame.

Then on the 5th frame, I put the xx.getColumnAt(0).width = 100 commands. When
ran, the data grid appears with all columns equal after the xml call, but then
once it hits the 5th frame and gets the xx.getColumnAt(0).width = 100 command,
it resizes.

I am stoked!! This dataGrid has been complicated to say the least!
AddThis Social Bookmark Button