Thanks all for your help on this.
What I can't get my head around and maybe that is why I cant get this to
work is, how does the DG knows to get the info from certail columns only?
I dont see the declaration that the information belongs to the DG.
Using Helen's sample
mydata = [{company:a, id:3}, {company:b, id:54}];
mygrid.columnNames = ["company"];
How does mygrid knows to get the column "company" from mydata when my
data has not yet beein delared to have a relationship with mygrid?
I saw the did the same here:
http://flash-creations.com/notes/servercomm_database.php
Which is the link provided
TIA.
Helmut.
Robert Chyko wrote:
When you are creating the columns in your datagrid do not create a
column for the id's, just for whatever you want to actually display.
Then you can put whatever values you want into your DataSet, but the
Datagrid will only display the values that have columns associated with
them.
So if in your for loop when you are adding to the DataSet, you can add
any properties you want (just like you are doing in your first push()
statement in your for loop):
myDataSet.push({ID:idValue, Name:name, Company:id, property4:value,
property5:value, etc......});
But you only want to display Name and Company, then you only create
columns for Name and Company in the datagrid:
var newCol = new DataGridColumn("Name");
newCol.headerText = "Name";
myDataGrid.addColumn(newCol);
var newCol = new DataGridColumn("Company");
newCol.headerText = "Company";
myDataGrid.addColumn(newCol);
If you don't get it, let me know, I can write up a quick .fla and send
it to you.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Helmut
Granda
Sent: Wednesday, December 14, 2005 1:26 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] DataGrid - Content
Thanks Robert,
Im glad to hear it can be done, with a for loop I am populating the
Datagrid:
myDataSet = newArray();
for (var i = 0; i<myResults.length; i++) {
//this will create 2 columns as we know it
myDataSet.push({ID:idValue, Name:name, Company:id});
//this will trow an error
myDataSet.push({Company:id, idValue});
}
How would I avoid creating a new column and not getting an error from
the compiler? Sorry I have been strugling with this project for a
LOOOOONG time and my brain is fried now. :)
Thanks!
...helmut
Robert Chyko wrote:
Sure, when you are setting up the Datagrid, just do not create a column
for the id's. When you add a row to the Datagrid you can keep id as
one
of the values, but it just will not be displayed because there is no
column for it.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Helmut
Granda
Sent: Wednesday, December 14, 2005 1:12 PM
To: Flashcoders mailing list
Subject: [Flashcoders] DataGrid - Content
Is there anyway to add Data to the Data grid but to keep some of the
data "hidden" for a later use?
EXE:
company = [a,b,c,d,e,f,g,h,i]
id = [3,54,97,23,65,87,54,23]
I am displaying the company array into my DataGrid, but I would like to
keep the ID in relation to the company, I can create an array and
display the company and its ID, but is there anyway to "hide" the ID
but
have it ready and linked to the company array?
Any Pointers greatly appreciated.
Helmut.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders