DataGrid - Create at runtime - How to Add Items??

I create a DataGrid at runtime and then and columns to it as need be. How Can I add items with the correct dataField if I don't if I don;t know this till runtime? In other word I'm having trouble constructing the Object to send to AddItem becase the dataField Name needs to be hard coded...
Below does not work for me because if I have more than one column then I can seem to figure out out to create  ItemObjFinal dynnamically.
var ItemObjFinal:Object = {ThisNameNeedsToBeDynamic: "text", ThisNameNeedsToBeDynamic: "value" };
I also tried creating an array of Objects like this:
var ItemObjFinal:Object = new Object;
var obj:Object= dgc.dataField;
ItemObjFinal [0] = {(obj.valueOf()):  dgc.headerText };
ItemObjFinal [1] = {(obj.valueOf()):  dgc.headerText };
=========================================================================================
              ac.addItemAt(dgc, int(ac.length));
              dataGrid_preview.columns = ac.toArray();
              var obj:Object= dgc.dataField;
              var ItemObjFinal:Object = {(obj.valueOf()):  dgc.headerText };
              var obj2:Object= dgc.dataField;
              var ItemObjFinal2:Object = {(obj2.valueOf()): dgc.headerText};
              //K Now add it!
              //IList(dataGrid_preview.dataProvider).removeAll();
              IList(dataGrid_preview.dataProvider).addItemAt(ItemObjFinal,0);
             //IList(dataGrid_preview.dataProvider).addItemAt(ItemObjFinal2,1);

Ahh answered my own question:
             ac.addItemAt(dgc, int(ac.length));
              dataGrid_preview.columns = ac.toArray();
              var ItemObjFinal:Object = new Object;
              var ItemObjFinal2:Object = new Object;
              for each(var col:DataGridColumn in ac)
                ItemObjFinal[col.dataField] = col.headerText;
                ItemObjFinal2[col.dataField] = col.headerText;
              ItemObjFinal[dgc.dataField] = dgc.headerText;
              ItemObjFinal2[dgc.dataField] = dgc.headerText;
              //K Now add it!
              if(IList(dataGrid_preview.dataProvider).length > 1)
                  IList(dataGrid_preview.dataProvider).removeItemAt(0);
                  IList(dataGrid_preview.dataProvider).removeItemAt(1);
              IList(dataGrid_preview.dataProvider).addItemAt(ItemObjFinal,0);
              IList(dataGrid_preview.dataProvider).addItemAt(ItemObjFinal2,1);
This code may still need some tweaking as I get an RTE at  "IList(dataGrid_preview.dataProvider).removeItemAt(1);"   but at least I'm able to solve my original question. Thanks Alex!

Similar Messages

  • Object array - how to add items?

    Hello!
    I have little problem, how to add item to array, to get something like this:
    Object[][] someObject = {
    {"1", "2"},
    {"4","5"}
    };From this:
    Object[][] someObject = {
    {"1", "2"}
    };? Thanks in advance!

    Once you allocate an array like that, you can't
    resize it.
    Object[][] someObject = {
    {"1", "2"}
    };creates an array with size [1][2]. You can't makeit
    any larger. You can create a new Object[][]
    with the new size, copy the elements into the new
    array, then add your new objects in the newposition.
    or even better use arraylistExcept that he's using this for a JTable, so the best he could do is a Vector. Yuck. :)

  • Create User Activity: How to add Roles to the new user

    Hi all,
    My Problem is Using LC Workbench I have created one process it is having Create User Activity. I am able to creating the new user with this process.
    But I dont have idea how to add roles to that new user? Please anybody can help me out
    Thanks in advance.

    Hi,
      I used Built-in Componets till now, Please help me out What are the steps needed to implement a custom componet.
    Thanks in advance

  • How to add item in advnace search LOV  of OA frame work ?

    HI,
    I have one requirement to add one new item in existing lov of advance search of vertical view in OA framework which is seeded.Through the Form personalisation
    I have created Criteria Row: (MscCreationdate_row) in which i have given ID value as MscxcreationDate
    and applied it then it get created. then created Message Lov Input only (and not able to create messageStyledText)
    as Level =Site Item ,Style =Message Lov Input
    there is lot of properties but i have filled only data type,promt I am not sure rest of the properties that what values should be there
    like Access Key,Attribute Set,View Attribute,View innstance etc...
    After that i have applied and found a option to create Lov Map: (MSCX_CREATION_DATE) and i mapped but there was also a lot of properties to fill
    like LOV Region Item,Return Item,Attribute Set,
    I have given LOV Region Item=MSCX_CREATION_DATE and same as return item.
    Could you please suggest me what values are needed in these properties here to add on field on advance search.
    when i open the advance search lov i found the creation date there and that get added in form also but when click in search button for value it threw the error:
    oracle.apps.fnd.framework.OAException: Application: FND, Message Name: FND-INVALID APPLICATION. Tokens: APPL = null;
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1223)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:2011)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:511)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:432)
         at oa_html._OA._jspService(_OA.java:84)
         at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
         at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417)
         at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267)
         at oracle.jsp.JspServlet.internalService(JspServlet.java:186)
         at oracle.jsp.JspServlet.service(JspServlet.java:156)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
         at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456)
         at org.apache.jserv.JServConnection.run(JServConnection.java:294)
         at java.lang.Thread.run(Thread.java:534)
    ## Detail 0 ##
    oracle.apps.fnd.framework.OAException: Application: FND, Message Name: FND-INVALID APPLICATION. Tokens: APPL = null;
         at oracle.apps.fnd.framework.webui.OAWebBeanFactoryImpl.getAppId(OAWebBeanFactoryImpl.java:5391)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:981)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:511)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:432)
         at oa_html._OA._jspService(_OA.java:84)
         at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
         at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417)
         at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267)
         at oracle.jsp.JspServlet.internalService(JspServlet.java:186)
         at oracle.jsp.JspServlet.service(JspServlet.java:156)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
         at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456)
         at org.apache.jserv.JServConnection.run(JServConnection.java:294)
         at java.lang.Thread.run(Thread.java:534)
    oracle.apps.fnd.framework.OAException: Application: FND, Message Name: FND-INVALID APPLICATION. Tokens: APPL = null;
         at oracle.apps.fnd.framework.webui.OAWebBeanFactoryImpl.getAppId(OAWebBeanFactoryImpl.java:5391)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:981)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:511)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:432)
         at oa_html._OA._jspService(_OA.java:84)
         at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
         at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417)
         at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267)
         at oracle.jsp.JspServlet.internalService(JspServlet.java:186)
         at oracle.jsp.JspServlet.service(JspServlet.java:156)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
         at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456)
         at org.apache.jserv.JServConnection.run(JServConnection.java:294)
         at java.lang.Thread.run(Thread.java:534)
    Can anybody suggest me what are the only steps need to follow?
    Thanks,
    Edited by: user10980325 on 30 Mar, 2012 11:44 PM

    Hi!
    For existing entries, you can use the SAVE_TEXT function module.
    You just have to pass the right key to the function element.
    Regards
    Tamá

  • How to add item in column header

    How can i add an messageStyled item(or any item) in column header? if so how can i do this

    Standard framework feature allows to add only a sortable header bean in a column header which holds some of the UI and runtime properties for that column.
    If you can explain your requirement, we can suggest the way to achieve that.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Creating a Course | How to add a lemma to the Outline?

    I am creating a course in iTunes U. I have created an Outline for the course in the template. I have saved the Outline and have continued with the other pages. Now, how do I add a lemma in the list of subjects in the Outline? The + is no longer visible. There also isn't a link Edit or anything else. The only thing I can do, is rename existing lemmas of the Outline.

    This is solved. Position the cursor after the text of the previous lemma and click Enter/Return.
    It would be more user-friendly if adding a new lemma would follow the same process in creating and editing mode.

  • How to add item to a List with a bounded wildcard

    Hi,
    Is there a way to add a subtype instance to a List with a bounded wildcard? For example, say I have an
    abstract class called Car. Then I have 2 concrete subclasses--Ford and Toyota. Now say I have another
    class that contains a prepopulated list and is wildcard bounded like this: List<? extends Car> carList. I
    want to add a method where I pass in a Car subtype as a parameter and then add it into this list, e.g:
    public void addCar(Car car) {
    carList.add(car);
    Trying this, I keep getting "cannot find symbol" compilation errors. When I went back to read the Generics
    tutorial by Bracha, he mentions that explicitly adding a subtype, e.g. carList.add(new Ford()), can not be
    done. But here I'm adding the "upper bound" of the wildcard, i.e. the Car type. Therefore there should be no
    discrepancy between supertype and subtype an thus the carList.add(car) should be ok, IMO.
    Am I misunderstanding something with this logic? Also, if carList.add(car) can not be done, then how can
    I go about doing something similar which will allow me to add subtypes to a "generic" list?
    Thanks in advanced!
    -los

    I get a compilation error expecting an Object instead of a Car. Of course you did. List<? super Car> is a list into which you can put cars -- and possibly other stuff. List<? extends Car> is a list out of which you can get cars (possibly of different makes).
    Do you need a list that you can put cars in and get cars out? That's List<Car>
    This isn't a linguistic problem you are having; this is a design problem. If you have a function that takes an argument which is a list that you can put any kind of car into and be sure of getting a car out of, it isn't reasonable to pass in a List<Ford> (because the function might put in a Chevy) or a List<Object> (but there might be motorcycles already in there). By the requirements you have, you need a List<Car> and nothing else.
    Yes, you could use a cast, but all you are doing is circumventing the type system by saying "I know this List<Object> only has Cars in it."

  • How to add items dynamically to the DropDown Ring control in Web UI Builder

    Hi All,
    Is there any way to add the item names to DropDown Ring Control in Web UI Builder?
    Or
    Is there any other control available to make selection in the Front Panel which can be dynamically loaded?
    Thanks,
    Alagar

    DiyaDiya  
    We do not currently have a solution for populating the items in a ring dynamically. 
    Thanks for the clarification.
    Seems incredible after all these years that such functionality (dynamically populating a ring control) is still beyond Labview. I must be missing something.
    However, I'd suggest a combobox is closer than a listbox as a workaround.
    [edit]
    nevermind, it actually can be done (well, maybe not in the webUI), I found the explanation here http://digital.ni.com/public.nsf/allkb/FB0409491FAB16FA86256D08004FCE7E

  • How to add items into giftlist

    hi all please give me the solutions and code

    Hi,
    Several servlet beans are provided to support gift list and wish list functionality. These servlet beans can be used with forms to look up gift lists and gift items, as well as to perform actions, such as removing or purchasing items from a gift list, adding gift lists to a profile, and removing gift lists from a profile.
    You can look at Pioneer Cycling Store as an example  in  /atg/commerce/gifts/GiftlistFormHandler component in the product display page with an option for the customer to pick a list for the selected item.
    <code>
    <dsp:form action="<%=form24%>" method="post">
         <input name="id" type="hidden" value='<dsp:valueof param="id"/>'>
         <input type="hidden" name="itemType" value="product">
         <input name="itemId" type="hidden" value='<dsp:valueof
                      param="Product.repositoryId"/>'>
         <dsp:input bean="GiftlistFormHandler.addItemToGiftlistSuccessURL"
              type="hidden" value="../user/lists.jsp"/>
         <dsp:input bean="GiftlistFormHandler.addItemToGiftlistErrorURL" type="hidden"
              value="../user/lists.jsp"/>
         <dsp:input bean="GiftlistFormHandler.productId"
              paramvalue="Product.repositoryId" type="hidden"/>
         <%/*Display any errors that have been generated during Cart operations: */%>
         <dsp:include page="../../common/DisplayGiftlistFormHandlerErrors.jsp"
              flush="true"></dsp:include>
         Add <dsp:input bean="GiftlistFormHandler.quantity" size="4" type="text"
                  value="1"/>
         <dsp:select bean="GiftlistFormHandler.catalogRefIds">
         <dsp:droplet name="/atg/dynamo/droplet/ForEach">
           <dsp:param name="array" param="Product.childSKUs"/>
           <dsp:param name="elementName" value="sku"/>
           <dsp:param name="indexName" value="skuIndex"/>
           <dsp:oparam name="output">
         <dsp:getvalueof id="option59" param="sku.repositoryId"
              idtype="java.lang.String">
    <dsp:option value="<%=option59%>"/>
    </dsp:getvalueof><dsp:valueof param="sku.displayName"/>
           </dsp:oparam>
         </dsp:droplet>
         </dsp:select>
         <BR>
         to
         <dsp:select bean="GiftlistFormHandler.giftlistId">
           <dsp:getvalueof id="option73" bean="Profile.wishlist.id"
                idtype="java.lang.String">
    <dsp:option value="<%=option73%>"/>
    </dsp:getvalueof>My Wishlist
           <dsp:droplet name="/atg/dynamo/droplet/ForEach">
             <dsp:param bean="Profile.giftlists" name="array"/>
             <dsp:param name="elementName" value="giftlist"/>
             <dsp:oparam name="output">
             <dsp:getvalueof id="option83" param="giftlist.id"
                  idtype="java.lang.String">
    <dsp:option value="<%=option83%>"/>
    </dsp:getvalueof><dsp:valueof param="giftlist.eventName">Undefined</dsp:valueof>
             </dsp:oparam>
            </dsp:droplet>
         </dsp:select>
         <dsp:input bean="GiftlistFormHandler.addItemToGiftlist" type="submit"
              value="I Want It"/>
        </dsp:form></dsp:getvalueof>
    </code>

  • [SOLVED]how to add items in gnome 3 file manager

    Added an illustrating picture describing what I want to do. It wont let me just drag them there, any suggestions?
    Last edited by Crypz (2011-10-01 17:52:12)

    rogue wrote:Is that Nautilus file manager? If so I think you use the bookmarks to add things to the places menu.
    Figured it out.
    Tried that bookmark thing earlier too but it didnt react/do anything.
    now i tried "edit bookmarks" and somehow managed to get the bookmark option activated. Bookmarks appeared on the left and can now drag items there.

  • [SOLVED] How to Add Items in the Awesome Menu?

    I hate to ask, but I've gotta say I've read the manuals extensively, and can't figure out certain things in awesome... I want to purchase a lua programming manual to have around, but in the meantime... I'm hoping one of you guys can throw me a bone here and help me figure out this one thing...
    I've added firefox to my awesome menu so now it's like awesome > open terminal > firefox. However, nothing happens when I select firefox, and here's my code:
    -- {{{ Menu
    -- Create a launcher widget and a main menu
    myawesomemenu = {
       { "manual", terminal .. " -e man awesome" },
       { "edit config", editor_cmd .. " " .. awesome.conffile },
       { "restart", awesome.restart },
       { "quit", awesome.quit }
    mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
                                    { "open terminal", terminal },
                    { "firefox", awful.util.getdir("config") .. "/firefox.png" }
    mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
                                         menu = mymainmenu })
    -- Menubar configuration
    menubar.utils.terminal = terminal -- Set the terminal for applications that require it
    Anyone know what I'm doing wrong?
    Last edited by w201 (2013-03-02 04:49:11)

    The syntax for adding a menu item to awesome goes like this:
    mywebmenu = {
    {" Chromium", "chromium-browser", beautiful.chromium_icon},
    {" Dropbox", "dropbox", beautiful.dropbox_icon}
    or
    mysettingsmenu = {
    {" WICD", "urxvt -x wicd-curses", beautiful.wicd_icon}
    As you can see, the first item in the list is the name of the menu item, the second is the command to be run, and the third is the icon to be displayed. If there's no third field, no icon is displayed.
    Your code for adding firefox to your menu will correctly show "firefox" as the menu name being displayed, since that's the first field you added, but will attempt to execute "awful.util.getdir("config") .. "/firefox.png"  when you click the menu item, since that's what you provided as the second argument. Since that's not an executable command, nothing happens.
    Since the "awful.util..." bit seems to be you trying to get the proper icon for firefox, I suggest adding an element to the list between the two you already have that is just "firefox". This will ensure that when you click on "firefox" in your menu, the command that is run is "firefox", which should launch your browser.
    Last edited by dcalacci (2013-03-01 21:21:01)

  • How to add more than one datafile while creating tablespace

    how to add more than one datafile while creating tablespace. I know by using alter command i can add datafile but i want while creating tablespace

    Hi Dadivela,
    how to add more than one datafile while creating tablespace.Here is the syntax:
    !http://www.dba-oracle.com/images/create_tablespace.jpg!
    I do it like this:
    create tablespace myts
    datafile
    *'/u01/app/oracle/db1.dbf' size 100m,*
    *'/u02/app/oracle/db2.dbf' size 200m;*
    Here are my complete notes:
    http://www.dba-oracle.com/t_tablespace_create_alter.htm
    Hope this answers your question . . .
    Donald K. Burleosn
    Oracle Press author

  • Add items in jlist

    hi
    im a bit confused as to how to add items to a jlist during runtime
    could someone please show an example

    Hi,
    Maybe this will help:
    http://www.exampledepot.com/egs/javax.swing/list_ListAddRem.html?l=rel

  • How to add the report

    how to add the report for jasper ,i am using jdeveloper tool  to create project but how to add the report for the that project please help me

    Make the broadcasting setting using BEx Broadcaster and schedule program RSRD_BROADCAST_STARTER in process chain for the required settings.
    Regards,
    Sree

  • How to add column comments to table

    at the time of creating the table, how to add the comments t columns.

    Hi,
    I do not see any way in which you can add comment on column while issuing create table command. You can add comment on the column only after the table is created.
    Regards
    Anurag Tibrewal.

Maybe you are looking for

  • SRM GoA with status as "Distribution Incorrect" althogh contract is created in ERP

    Dear SRMers, We are using the classic scenario with SRM 7.0.2. I am facing a problem with Global out line agreements in SRM where the status of the GoA is showing as: "Distribution incorrect". We have verified that the respective IDOC of type BLAORD

  • Unable to sync in the right calendar

    I'm having issued with synchronizing my outlook with my bb.  I have multiple calendars. In my bb, I made sure to default my calendar to the one I want.  However, when I sync, the default calendar doesn't pick it up, it goes to another one.  It used t

  • Problem with 861W Setup

    I got myself an 861W and had been fighting with the configuration for a while. Now I got the configuration so far, that LAN Connectivity is working, WLAN is working. I can connect an WLAN Client to the AP and reach the IPs of the AP and Router VLANs.

  • What is the best way to run a VBScript in labview 6.1

    I am trying to call some VBscript I have written using Labview 6.1. Any body got any Ideas how to do this without running a dos prompt?

  • Aperture crashes with right click or control click

    I have a iMac 24 2.4 with 3Gb Ram Ive installed Aperture 2 and started using it. I had a previous version before with no problems. Every time I right click or control click A2 crashes. Ive uninstalled and reinstalled with no fix. here is my console c