Passing array data into datagrid

Hi,
I need to pass data from an Array ( of Strings) into a datagrid. I have used the following text:
<mx:DataGrid id="dg1" x="400" y="50" dataProvider="{myArray}">
<mx:columns>
          <mx:DataGridColumn headerText="Names" />
</mx:columns>
</mx:DataGrid>
The DataGrid does not show any data as I have not mentioned the dataField. Can you please tell - what woud the dataField be in this case as the array contains simple strings.

Because your adding an Object to the arrayCollection you can add as many field names as you like as below.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
    <mx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            [Bindable]
            private var ac:ArrayCollection = new ArrayCollection();
            private function init():void {
                var obj:Object = new Object();
                obj.name = 'Andrew';
                obj.town = 'Taunton';
                obj.sex = 'Male';
                var obj1:Object = new Object();
                obj1.name = 'Jane';
                obj1.town = 'Glastongury';
                obj1.sex = 'Female';
                ac.addItem(obj);
                ac.addItem(obj1);       
        ]]>
    </mx:Script>
    <mx:DataGrid x="42" y="47" dataProvider="{ac}">
        <mx:columns>
            <mx:DataGridColumn headerText="Name" dataField="name"/>
            <mx:DataGridColumn headerText="Town" dataField="town"/>
            <mx:DataGridColumn headerText="Sex" dataField="sex"/>
        </mx:columns>
    </mx:DataGrid>
</mx:Application>
In yours you just need to loop through your data source and create the objects and add them to the collection.
Andrew

Similar Messages

  • How to insert data into datagrid dynamically and also programatically with data and column names being retrived from a xml file..

    iam not able to insert data into datagrid corresponding to the column names..as iam inserting both data and column names programatically..ie iam not able to co relate the data with the column names.plzzz help me asap

    A DataGrid is row-based rather than cell-based with each row
    corresponding to an item in an underlying collection (specified in the
    dataProvider property). In order to add data to a DataGrid you
    manipulate the underlying collection, rather than the grid directly.
    Based on the limited description of your problem I would imagine you
    would need to create dynamic objects with property names that correspond
    to the dataFields of your dynamically created datagrid columns.
    So if you had created columns with dataFields "alpha", "beta" and
    "gamma" on your datagrid, you could create an item in your grid by
    adding the following object to your dataProvider:
    var gridItem : Object = new Object();
    gridItem.alpha = "alphaValue";
    gridItem.beta = "betaValue";
    gridItem.gamma = "gammaValue";

  • Passing variable data into XSLT

    Hai all, I am trying to pass variable contents into a XSLT. I am trying the procedure given in the link below.I am not able to pass the parameter values into XSLT file.I am failing in the last step.
    Has anyone tried this example
    http://blogs.oracle.com/rammenon/2007/05/passing_bpel_variable_contents.html
    or
    Is there any other way to pass variable data into XSLT. Kindly help.
    Thank You

    True, the sample also uses the same function that I mentioned :
    <!-- convert Invoice to PO using XSLT service -->
              <assign name="transformVehicle">
              <copy>
                   <from expression="ora:processXSLT('InvToPo.xslt',bpws:getVariableData('input','payload') )"/>
                   <to variable="output" part="payload"/>
              </copy>                    
              </assign>

  • Passing array args into stored procs

    Hi,
    we are trying to use TopLink to perform the mapping of a pretty large schema (200+ tables). For the purpose UI presentation we only need a few different view types, not the full information in the schema, so we want to provide specific "view objects" mapped to the DB that can be batch read by their ids.
    Defining views in the DB and mapping these to objects with TopLink doesn't work well because the views require joins and the tables are pretty large (the WHERE IN on the ids of the rows to read from the view is only applied after the entire view is instantiated).
    Alternatively, we are trying to use stored procedures that take a VARRAY or TABLE OF INTEGER as input arg and return respective cursors. However, we couldn't figure out how to pass array infos into a stored proc using TopLink. Any suggestions?
    Thx,
    Olaf

    I believe when you're doing it with an insert, you're saying "execute this insert statement a bunch of times, here's all the values in advance", which is different than passing an array to a stored procedure where you want it to execute once.
    Oracle's ODBC driver doesnt support Associative Arrays (aka index-by tables).
    Hope it helps,
    Greg

  • How to pass table data into below code for alv

    hi
    i want to pass table data into alvgrid
    i dont know how to pass table data.
    here instead of passing ABC into internal table
    i want to pass table data .
    please help me
    ialv-test1 = 'ABC'.
    form get_data.
    ialv-test1 = 'ABC'.
    ialv-test2 = 'DEF'.
    append ialv.
    ialv-test1 = 'GHI'.
    ialv-test2 = 'JKL'.
    append ialv.
    ialv-test1 = '123'.
    ialv-test2 = '456'.
    append ialv.
    endform
    thanks in advanced.

    Have a look at below links. It gives you sample code of alv grid.
    http://sap.niraj.tripod.com/id64.html
    http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm
    Have a look at below links for SAP Help.
    http://help.sap.com/saphelp_nw04/helpdata/en/8d/e994374c9cd355e10000009b38f8cf/content.htm
    http://help.sap.com/saphelp_erp2004/helpdata/en/12/904f42d5f811d2b469006094192fe3/content.htm
    Best Regards,
    Vibha
    *Please mark all the helpful answers

  • Passing Arrays to the DataGrid Component

    How's it going my peoples? I'm having some difficulties
    passing Arrays into a DataGrid Component. It just doesnt seem to
    work for me. Anyone have any ideas on the best way of doing this?
    Thank you in advance.

    We have Our site build using odp.net but suddenly it stoped working on the production server. MS Provider is working fine in that case. so we want to have one copy of solution with MS provider as backup copy so in future if any failure occurs to odp.net we can use this copy. So for that I need to know how to pass arrays to oracle using MS Provider.
    Regards,
    Suresh

  • Using a Progressbar while showing database data into Datagrid

    Hi ,
    I am displaying the data from DataBase into DataGrid using Java (JDBC) .
    This data is large , so for displaying its time , so in meanwhile i want to use a ProgressBar for this .
    Please suggets me should i use a determinate or Indeterminate Progress Bar .
    Please share your ideas .
    Thanks
    Ravi Kiran .

    You could put up an indeterminate progress bar with a "please wait" label, all inside a TitleWindow pop-up set to modal. When your data are returned, remove the pop-up. You wouldn't use a determinate progress bar because web services don't dispatch the events used to update the progress bar.

  • Passing array variables into functions (and why I'm hopeless at arrays)

    OK, I have spent a day on this now and have done some fairly
    extensive searching online. The problem is - I am hopeless with
    arrays (and probably just actionscript generally for that matter)
    I want to create an array of buttons, so I set up an array of
    actions, step through each item and then try to pass that array
    action into an onclick button for an attached button
    The problem I have is that the onclick function ALWAYS
    returns the last item in the array.
    Help!
    Code below:
    ----------------------------------------------------------------

    the reason for this, is that once the for loop executes, the
    'last' value is the only one remaining. what one needs to do here
    is 'store' the string in a newly created property on each button,
    like this:

  • Passing XMLType Data into oracle stored procedure using JDBC

    Hi Friends,
    I have requirement where my oracle stored procedure accepts XML file as an input. This XML File is generated in runtime using java, I need to pass that xml file using JDBC to oracle stored procedure. Please let me know the fesibile solution for this problem.
    Following are the environment details
    JDK Version: 1.6
    Oracle: 10g
    Server: Tomcat 6.x
    Thanks in Advance

    user4898687 wrote:
    I have requirement where my oracle stored procedure accepts XML file as an input. This XML File is generated in runtime using java, I need to pass that xml file using JDBC to oracle stored procedure. Please let me know the fesibile solution for this problem.As stated - no.
    A 'file' is a file system entity. There is no way to pass a 'file' anywhere. Not PL/SQL. Not java.
    Now you can pass a file path (a string) in java and to PL/SQL.
    Or you can pass xml data (a string) in java and to PL/SQL. For PL/SQL you could use eithe a varchar2, if the xml is rather small, or a blob/clob.

  • Passing additional data into setValue

    I want to send additional data from outside of a datagrid
    alongside the normal item object that goes inside the setValue
    function of a cellrenderer.
    Specifically, I have an XML node that has some properties in
    its parentNode, when I send the node itself into the setValue, I
    need to get some values from its parent node, only that its parent
    node is outside of the datagrid, in a repeater (that builds
    multiple datagrids).
    Any idea about how to do that?

    Hello again:
    I think saisri2k2's suggestion has put me on the right track, although working on this for the past couple of days has not solved the problem.
    If anyone wants to look at this, the project is here, http://www.timos.com/LeCreuset/LeCreuset.html and View Source is enabled. The file you want to look at is src > renderers > ProductThumb.mxml.
    If you are looking at source, know that I have tried the following:
    the variable ‘filterCount’ as public static;
    the function ‘showsSalePrice()’ inside the get data getter instead of on the dataChange event;
    invalidateProperties() in various places.
    None of the above has worked: the filterCount is correct when you select a new category. When you select a category with fewer than 16 products, the tiles change to a state where they are bigger (as they should). But once they have turned bigger, they don not want to return to a state where they should be smaller when you switch to a category with more products. If you try changing categories using the ComboBox you will see this.
    So I don’t know what else to try. I have a hunch this may have something to do with the fact that the renderers are recycled when the containing list uses the virtualization (which apparently you can’t turn of in an s:List).
    If anyone has any ideas/suggestions, I would love to hear them.
    Thanks and greeting to y’all,
    Carlos

  • How to convert digital array data into analog signal

    i want help to convert digital data array into analog signal

    shubham62 wrote:
    We are implimenting real time audio trans-receiver. We have converted input audio data(analog form) into digital data. At the receiver side we received digital data which is in the form of digital data array.But we are unable to recover back our original input data. So please help us to sort out the problem.
    Still no useful information.  How was the data converted to digital in the first place?  What conversion parameters did you use?  As was said, you just need to do the math backwards to get it back into the analog.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to Read and write array data into notepad or lvm?

    Hello,
    I am new to Labview and i wanted to use it in my project where i get accelerometer values X,Y and Z serially into a notepad and then displaying those values in Labview as a 3D plot or graph.The problem i am facing is the use of Cover to dynamic data express VI and how to save the array in a notepad or a lvm file.i was testing a basic block of building x and y values separately.was successful in plotting it to  graph but dont know how to save those values in a file.Can some1 please help me out in his ??
    Solved!
    Go to Solution.
    Attachments:
    Capture.PNG ‏22 KB

    Thank you for looking into this. Since I was converting into dynamic data before writing it I thought you have to convert it after reading but then I got stuck as to whether build the array again so as to display it in the graph. Dennis I did what you said and the graph on reading is a bit funny just started today and I am kinda skipping the long tutorial due to shortage of time. sorry
    Attachments:
    Capture.PNG ‏32 KB
    Capture2.PNG ‏59 KB

  • How can I copy Captivate 6.x document array data into a new Javascript array

    I'd like to copy an array from my captivate document variables to a variable within a script my project runs.  I attempted to use objCP.cpEIGetValue("m_VarHandle.Array.slice(0)") but that didnt seem to work.

    One the primary things I learnt at Uni is the Object Oriented Modal of design and Development, MVC etc.
    Seperation of the function, display, data being a fundemental point to develop and all the benifits of that.
    Also, Your HTML code will weigh more, i.e. a web page riddled with similar code will have a kb size that is a lot larger than necessary. The inline script and css will make the source more dense, search engines have to sift through it to find your actual content.
    Your HTML code will never be truely cached but the external dependencies, such as the CSS and JavaScript files, will be cached by the visitor’s web browser after the first visit – this means that instead of loading a lot of superfluous HTML code for every page in your web site the visitor visits, it will quickly retrieve all style and interaction locally from the web browser cache and thus improve perfomance further.
    No fall back interaction, and harder to manage, correct and update along with poor attrinbute accessability. Having your scripting in one central location makes your development time more effecient, working on new aspects of the site has no effect on the live site, functions can be wrote once called many times and only when needed. Object coding in Javascript improves performance, management, use and more also.
    With these in mind the page load is just longer with inline scripting and the event handling is poorer and then coupled with the other elments mentioned above.
    Just better done right BC has runs gzip, you can optimise your code and the server caching of css, script, image files and the browser it just all leads to better perfomance of your site which is also increasingly something google wants to see to rank you well.

  • How to retrieve the xml data into datagrid in vb6.0 using dom method

    <?xml version="1.0" standalone="yes"?>
    <Student_Details>
      <Student>
        <Name>sandeep</Name>
        <Age>12</Age>
        <Mobile>123456789</Mobile>
      </Student>
      <Student>
        <Name>ololjk</Name>
        <Age>kjlokmo</Age>
        <Mobile>njonojniohuj</Mobile>
      </Student>
      <Student>
        <Name>Sandeep Pr</Name>
        <Age>12</Age>
        <Mobile>9865231870</Mobile>
      </Student>
      <Student>
        <Name>ololjk</Name>
        <Age>kjlokmo</Age>
        <Mobile>njonojniohuj</Mobile>
      </Student>
      <Student>
        <Name>ololjk</Name>
        <Age>kjlokmo</Age>
        <Mobile>njonojniohuj</Mobile>
      </Student>
      <Student>
        <Name>ololjk</Name>
        <Age>kjlokmo</Age>
        <Mobile>njonojniohuj</Mobile>
      </Student>

    this forum is for vb.net, for vb6 you could try
    http://www.vbforums.com/forumdisplay.php?1-Visual-Basic-6-and-Earlier
    http://forums.codeguru.com/forumdisplay.php?4-Visual-Basic-6-0-Programming
    PS. vb6 is ancient software you might want to consider a language from this century

  • How to pass csv data from file into DLL using TestStand

    Hi,
    We have data files which are of CSV format. Each row contains
    about 9 items of data, and have about 5 rows of this data (ie, 5
    test points) :
    eg
    TErrAdd1,UUT,UUT,STM1E,AU4/FR,PRBS23,BIT,10,60
    TErrAdd2,UUT,UUT,STM4O,AU3/UNFR,PRBS15,B1,20,60
    TErrAdd3,UUT,UUT,STM16O,AU4_16C/UNFR,PRBS9,BIT,7,60
    TErrAdd4,UUT,UUT,STM0E,AU3/UNFR,PRBS20,B2,5,60
    TErrAdd5,UUT,UUT,STM64O,AU4_4C/FR,PRBS11,B1,6,60
    What we want to do is to be able to directly pass each
    row of data to a C/C++ DLL. The DLL fn accepts this
    data as a vector of strings.
    eg.
    void DLLTestFn( vector const & configData )
    However, we can write a wrapper for the DLL as I don't
    think TestStand will know about vectors.
    We don't really want to have to hardcode individial references
    to each item of data in TestStand. Is this possible?
    Just read in a row from a data file, and sent it direct
    to the DLL?

    Hi Richardi,
    the principle is quite simple, however, you still need to use a programming language to make the initial file read.
    Once you've done this, you could have it as an array of strings, and pass this directly to a wrapper DLL, which would then pass the data into a string vector.
    Look up the examples\AccessingArrays\PassingArrayParametersToDll\AccessingArrays.seq
    to see how to do this without passing the sequence context.
    If you've read in the details into a container type structure already, then I've made an example which demonstrates this principle and what you'll need to pass it to a vector. (Similar principle can be used to fill in the container when you read the file in the first place.
    You cannot go directly to a vector, since TestStand doesn't understand them.
    Vector classes are difficult to export polymorphically from a DLL since the template class doesn't export, and needs specifically defining. This is what I'm assuming you're ultimately trying to do. (see ref :
    How to Export STL components inside and outside of a class
    I've used VIsual C++ 6 and TestStand 3.0
    Please let me know if this helps to answer your query.
    Thanks
    Sacha Emery
    National Instruments (UK)
    // it takes almost no time to rate an answer
    Attachments:
    for hannah vectors.zip ‏1619 KB

Maybe you are looking for