Quantcast
Channel: Adobe Community : All Content - All Communities
Viewing all articles
Browse latest Browse all 290743

Load directly from php as DataProvider for datagrid

$
0
0

Hi

 

The normal method to load data from php in to a datgrid is to push it into and array first...:

 

for(var i:uint=0; i<event.target.data.dgRows; i++)

{

                dgArr.push

                ({

                                id:event.target.data["id"+i],

                                dateLogged:event.target.data["dateLogged"+i],

                                quoteNumber:event.target.data["quoteNumber"+i],

                                clientPoNum:event.target.data["clientPoNum"+i],              

                                compName:event.target.data["compName"+i],               

                                exclusive:event.target.data["exclusive"+i],              

                                TAX:event.target.data["TAX"+i],           

                                inclusive:event.target.data["inclusive"+i]

                });

}

 

DG1.dataProvider = new DataProvider(dgArr);

 

 

What I'd like to know is if it is possible to pass "event.target.data" directly as a dataprovider, tried this but didn't work for obvious reasons: DG1.dataProvider = new DataProvider(event.target.data);

 

Basically I want code that doesn't have to change for each php file and reduce the amount of coding lines  eg. I want to eliminate\change to 'dynamic':

"for(var i:uint=0; i<event.target.data.dgRows; i++) {dgArr.push({ ....... });"

 

Something like this would be awesome...

 

for(var key:String in map)

{

                dgArr.push

                ({

                       key : map[key]

                });

}

 

(the above code will add a row for each key which actually represent a column which is totally not what is required and is empty because the "key" must indicate.... )

 

 

Help will be appriciated


Viewing all articles
Browse latest Browse all 290743

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>