View Full Version : Adding data to a blank datagrid

11-01-2005, 12:21 PM
I have a Datagrid that is populated via a Web Service.

When the database the Web Service is retrieving data from is blank then the Datagrid is blank.

I have successfully configured the datagrid to add records to a database containing data but unfortunately cannot do the same
when the datagrid is blank.

To add new records I am using one input field for each column of the datagrid.

Any assistance is greatly appreciated.

Kind Regards,

11-13-2005, 10:43 PM
Hi Boulent,

This is how I construct a datagrid and populate it from my web service. Hope it helps:

//this is what happens when the webservice returns successfully
function getStoriesGood(re:ResultEvent):Void{
//create array
var storiesDP:Array=new Array();
//loop over web service results
for (var i=0; i<re.result.length; i++){
// and add results to array
storiesDP.addItem({StoryID:i,Headline:re.result[i].HEADLINE, Story:re.result[i].STORY, Posted:re.result[i].STORY_DATE})
//create datagrid object and set properties
section_mc.form_mc.createObject("DataGrid", "stories_dg");
section_mc.form_mc.stories_dg._x = leftAlign;
section_mc.form_mc.stories_dg._y = topAlign+50;
section_mc.form_mc.stories_dg.multipleSelection = false;
section_mc.form_mc.stories_dg.setSize(500, 350);
//tell datagrid to get data from array
section_mc.form_mc.stories_dg.dataProvider = storiesDP;
section_mc.form_mc.stories_dg.sortItemsBy("StoryID", "ASC");

01-03-2008, 03:24 AM
hi I want to make a datagrid where by clciking a filed I can input data also . ow to do that?
one way is editable="true" but that will enable for all rows & columns . I want to do it for selected columns only . and I want to disable clicking