Creating and deleting symbols dynamically

I need help with getting this particular function implemented.
I have 2 buttons with codes which I've added
//Create button
$.getJSON("content.JSON")
  .success(
  function(data){
  console.log("incoming data: ", data);
  //console.log("this is current value of var s", template);
  if (s == null)
  $.each(data, function(index, item){
  //var s = sym.createChildSymbol( "template", "content");
  s = sym.createChildSymbol( "template", "content" );
  // Creating the variable that save my new instance of mySymbol
  sym.setVariable("itemContainer"+i, s);
  console.log("item container name", s);
  s.$("title").html( item.item );
  s.$("description").html( item.description );
  s.play(index * -500);
  i++;
  //console.log("'dressbtn' inside was CLICKED");
  else
//Delete button
for(var p = 1; p <= i; p++)
s = sym.getVariable("itemContainer"+p);
s.deleteSymbol();
i = 1;
So the two buttons one will get the items from Json and display them, and the other will clear the symbols created.
But I've only managed to clear the symbols on stage only once, and after that I'm getting Javascript error in event handler! Event Type = element
The reason is because I'm trying to make an app that can get information off a json file from a webserver and able to update and display the lastest information in the app. So I've to be able to allow the user to press a button to refresh the page.
Can anyone shine some light on this?
Dropbox - test.zip

Hi,
Your issues (or troubles) come from your json file. Your json file is not well formed.
Here is a correct one:
{"shoes":[
{"item":"red shoe","description":"prada red shoe"},
{"item":"black shoe","description":"Black canvas shoe"},
{"item":"tilith shoe","description":"tilith ballet shoe"},
{"item":"gold shoe","description":"gold ballet shoe"},
{"item":"ganma shoe","description":"ganma canvas shoe"}
Then your buttons code:
1) mybtn.click:
//get json information and display
$.getJSON("content.JSON")
  .success( function(data){
  console.log("incoming data: ", data);
  $.each( data.shoes, function(index, item){
  var s = sym.createChildSymbol( "template", "content");
  s.$("title").html( item.item );
  s.$("description").html( item.description );
  s.play(index * -500);
  } );//each
   } );//success
2) btn_2.click:
//deleting shoes (symbols)
var symbols = sym.getChildSymbols();
$.each(symbols, function(index, item){
  console.log("symbols on stage: ",item.getSymbolTypeName());
  if (item.getSymbolTypeName() == "template") item.deleteSymbol();
Download link: test-2 - copie.zip - Box

Similar Messages

  • BAPI for purchase order .. to create and delete confirmation

    HI Gurus
    I need to create and delete PO(Purchase order) confirmation in SAP 4.7 R3 .
    Please let me know which BAPI i can use for .. in SAP 4.7
    1. Create PO confirmation
    2. Delete PO confirmation
    Many thanks and regards
    Sandeep Sharma

    Hi Sandeep,
    In SAP 4.7 R3 & ECC 5.0. we don't have BAPI to delete / create PO confirmatons.
    Use this FM for both : ME_CONFIRMATION_UPDATE
    In addition to above , we need to use this FM : ME_CONFIRMATION_REDISTR_ITEMS , for PO item update in MD04 transaction.
    In addtion to above 2 FM, you need to used Change doucment FM for write log data.
    Thanks.

  • How to identify combination of created and deleted Bank Details

    Hi Experts,
    I will develop a report similar to standard report RFKABL00. The requirement is to display the date, time, vendor number, vendor name, changed by, field name, company, purchasing org, new value and old value everytime a user make a change on the bank details (Bank Key and Bank Account only in XK02).
    The content of field name will be either Bank Key or Bank Account with its corresponding old and new value. Using transaction XK02, I tried to replace the Bank Account of the vendor and saved the data. The created and deleted values can be found in CDPOS using: objectclas: kred, tabname: lfbk and fname: key; but it is difficult to identify the correct combination of deleted and created values. I observed that for non-key fields in LFBK table there are entries for old and new values but for key fields like bank key and bank account they have nothing.
    How will we identify the correct combination of deleted and created values if there are many entries in CDPOS?

    Murali,
    As already specified in your previous thread. You can get the id using source code. or extend the CO and print the value of s2.
    Regards,
    Gyan
    www.gyanoracleapps.blogspot.com
    www.querenttech.com

  • Help on creating and deleting xml child elements using Toplink please.

    Hi there,
    I am trying to build a toplink xml demo illustrating toplink acting as the layer between my java code and an xml datasource.
    After pulling my custom schema into toplink and following the steps in http://www.oracle.com/technology/products/ias/toplink/preview/10.1.3dp3/howto/jaxb/index.htm related to
    Click on Mapping Workbench Project...Click on From XML Schema (JAXB)...
    I am able to set up java code which can run get and sets against my xml datasource. However, I want to also be able create and delete elements within the xml data for child elements.
    i.e. in a simple scenario I have a xsd for departments which has an unbounded element of type employee. How does toplink allow me to add and or remove employees in a department on the marshalled xml data source? Only gets and sets for the elements seem accessible.
    In my experience with database schema based toplink demos I have seen methods such as:
    public void setEmployeesCollection(Collection EmployeesCollection) {
         this.employeesCollection = employeesCollection;
    Is this functionality available for xml backended toplink projects?
    cheers
    Nick

    Hi Nick,
    Below I'll give an example of using the generated JAXB object model to remove and add a new node. The available APIs are defined in the JAXB spec. TopLink also supports mapping your own objects to XML, your own objects could contain more convenient APIs for adding or removing collection members
    Example Schema
    The following XML Schema will be used to generate a JAXB model.
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
         elementFormDefault="qualified" attributeFormDefault="unqualified">
         <xs:element name="department">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="employee" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="employee">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="name" type="xs:string"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
    </xs:schema>---
    Example Input
    The following document will be used as input. For the purpose of this example this XML document is saved in a file called "employee-data.xml".
    <department>
         <employee>
              <name>Anne</name>
         </employee>
         <employee>
              <name>Bob</name>
         </employee>
    </department>---
    Example Code
    The following code demonstrates how to use the JAXB APIs to remove the object representing the first employee node, and to add a new Employee (with name = "Carol").
    JAXBContext jaxbContext = JAXBContext.newInstance("your_context_path");
    Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
    File file = new File("employee-data.xml");
    Department department = (Department) unmarshaller.unmarshal(file);
    // Remove the first employee in the list
    department.getEmployee().remove(0);
    // Add a new employee
    ObjectFactory objectFactory = new ObjectFactory();
    Employee newEmployee = objectFactory.createEmployee();
    newEmployee.setName("Carol");
    department.getEmployee().add(newEmployee);
    Marshaller marshaller = jaxbContext.createMarshaller();
    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
    marshaller.marshal(department, System.out);---
    Example Output
    The following is the result of running the example code.
    <department>
         <employee>
              <name>Bob</name>
         </employee>
         <employee>
              <name>Carol</name>
         </employee>
    </department>

  • How to create and delete an Endeca application in Windows

    HI,
    can you please help me in ,
    how to create and delete an Endeca application inWindows machine not in Linux Machine.
    Thanks.....

    Hi,
    Steps to create an Endeca Application are clearly given in Getting Started Guide.
    http://docs.oracle.com/cd/E38680_01/Common.311/pdf/GettingStarted.pdf (Chapter 6 : Deploying a Reference Application)
    If you want to create an endeca application so as to integrate with Product Catalog system such as ATG using ATG 10.1.1 or above , then create an endeca application using the discover-data-catalog-integration reference application. Steps for doing this are documented in ProductCatalogDTGuide
    http://docs.oracle.com/cd/E38679_01/ToolsAndFrameworks.311/pdf/ProductCatalogDTGuide.pdf (Deploying the Product Catalog Application)
    To delete an Endeca Application that you have created in Windows/linux
    1. Navigate to the control directory of the application that you want to remove and execute the script
    runCommand.bat --remove-app (Removes the provisioning information with EAC admin console)
    2. Remove the instance configuration files for the application using the emgr_update command line utility
    emgr_update.bat host localhost:8006 app_name My_app action remove_all_settings prefix My_prefix
    3. You can then explicitly delete the directory in the Endeca_apps directory where you have initially created your application.
    If you are using discover-data-catalog-integration, you can remove the CAS Record Store Instances by navigating to CAS/bin directory and executing
    ./component-manager-cmd.sh delete-component -n {YOUR_APP_RECORD_STORE_NAME}
    Thanks,
    Shabari

  • CREATE and DELETE operations in MI7.1 for PDA

    Hi,
    We are developing a sample scenario for PDA in 7.1. Problem is we are able to implement GETLIST, GETDETAIL and MODIFY operations but not able to implement CREATE and DELETE operations. For GETLIST and GETDETAIL i have created queries. Modify is also simple (i am creating a form to edit and commiting data once i click on save). But to implement CREATE and DELETE we dont have any reference.
    Regards,
    Vinay

    Hi,
    Now i know the answer
    There is a typed method on the service component model class for root node creation. Example for binding a new root instance to a context node:
    wdContext.nodeCurrentEmployee().bind(Collections.singleton(model.createEmployeeSdoEmployee()));
    where model is your webdynpro model.Employee is a context node model bounded to Employee model class.This node has to be manually created in context(and then can be context mapped and bound to elements in view)
    wdContext.nodeCurrentEmployee().setLeadSelection(0);
    Creating a child is done on the root itself, but persisting it is a two step process:
    address = employeeRootNode.createNewAddresss(); <- this only creates the instance in memory
    where employeeRootNode is the model object for which the child has to be created. If the element for which the child has to be created exists in context then it can be got by
    wdContext.nodeEmployee().currentEmployeeElement.model()
    employeeRootNode.addToAddresss(address);  <- this persists the new instance
    wdContext.nodeCurrentAddress().bind(Collections.singleton(address));
    wdContext.nodeCurrentAddress().setLeadSelection(0);
    Delete of a root is also done on the sc model class:
    model.removeEmployeeSdoEmployee(employeeRootNode);
    Delete of a child is done one the root:
    employeeRootNode.removeFromAddresss(address);
    Hope this helps.
    Regards,
    Vinay
    Edited by: Vinay TS on May 5, 2008 8:31 AM

  • Move the created (and modified) symbol to another div.

    Hi,
    Let's say i have a container (it's a symbol... sym.container=sym.createChildSymbol("container","containers");)
    1. Created a child symbol "object" in one container.
    sym.object=sym.container.createChildSymbol("object","containerForObject");
    2. Made several changes to it.
    What i want to do now, is to
    1. Create a new container. sym.container2=sym.createChildSymbol("container2","containers");
    2. delete the symbol the "object" was in. sym.container.deleteSymbol().
    3. Put the "object" (without creating it again, just moving it) in the, new, sym.container2's "containerForObject".
    <out of ideas>
    Thanks,
    Dario

    Hi, Dario-
    When you call deleteSymbol, you're actually deleting the entire instance of the symbol.  Is there a reason you want to reparent the symbol that way?  Another way to handle it is to create the symbol attached to the Stage or a dummy object and then create a link to it using a variable on one symbol or another.  That way, you only create the object once but have a reference to it in one symbol or the other.
    Hope that helps,
    -Elaine

  • Problem with creating and deleting row in table

    Hi
    I'm using JDev11.1.1.2.0. I have a table "A" with primary key X -> CHAR(1). I have created Entity and ViewObject (with the primary key X).
    I created an editable Table with CreateInsert and Delete actions.
    When I click Insert, a new record is added and I enter some data. Then I move selection to some other row, and return back to the new row. When I press Delete, It does not delete the new row, but the previous one selected.
    In the console, when I navigate back two the new added record: <FacesCtrlHierBinding$FacesModel><makeCurrent> ADFv: No row found for rowKey: [oracle.jbo.Key[null ]].
    I tried the same scenario with a different table, that has RowID as a primary key and it works correctly.
    Any Idea why this is happening ? I suppose it's connected somehow with the primary key.
    Thanks
    agruev
    Edited by: a.gruev on Nov 26, 2009 9:47 AM

    I changed my entity: unchecked the X column to be primary key added RowID as a primary key. Now it works.
    What's wrong with my CHAR(1) as a primary key ?
    I also tried to add a Refresh button:
      <af:commandButton text="Refresh" id="cb3"/>and in the table add a partialTarget to the button. Now when I add new row and press the Refresh button - then it works.
    So it seems that the problem is when I add new row and enter data, the table is not refreshed and the row is missing it's primary key.
    Any solutions?
    Edited by: a.gruev on Nov 26, 2009 4:18 PM

  • Creating and filling JTables dynamically

    Hello,
    How can I create and display a JTable dynamically in a Java application? In my application, I retrieve rows from a database and therefore I don't know in advance how many rows I need for my JTable (using the tablemodel). I tried to solve the problem in the following way:
    1)start op applicatie with a JTable with 0 rows (screen is grey, only columns are visible)
    2)run query and count number of rows.
    3)create new JTable based on number retrieved in step 2 and tried to put it onto the screen.
    4)run query again and fill table with values retrieved from query
    The bottleneck so far is step 3. I can create a new table but I don't manage to put it onto the screen (i tried already the repaint() method)
    Thanx for you help
    Frits

    Sure, no problem. Assume you've retrieved the following result from the database:First Name     Last Name     Age
    John           Doe           25
    Jane           Doe           27
    Joe            Smith         40
    Mary           Smith         19You create your JTable as like this:Vector headings = new Vector();
    Vector rows = new Vector();
    Vector cells = null;
    JTable table = null;
    for(int x=0; x< resultSize; x++){//resultSize is the size of your result
      cells = new Vector(); //Cells together will represent a row
      cells.add(yourResult.getTheFirstColumnForRowX()); //Pseudo-code
      cells.add(yourResult.getTheSecondColumnForRowX()); //Pseudo-code
      cells.add(yourResult.getTheThirdColumnForRowX()); //Pseudo-code
      //Now place those cells into the rows vector
      rows.add(cells);
    //Create the JTable
    table = new JTable(rows, headings);This code is not tested and is meant to give you an idea of how the concept can be applied. Hope it helps.

  • Creating and deleting users using AM Client SDK

    Hi,
    I was wondering if anyone could tell me how to create and/or delete users from Access Manager from a standalone application using the AM Client SDK? From what I have read this can be done using the AMStoreConnection class but I can't find any examples on how to use this class to add and delete users. The only examples I have found is how to retrieve data from AM. I need to keep AM and the underlying directory server in sync with another identity datastore so I need to build a process in Java to do this. Any help is appreciated.
    Thanks
    -Jeff

    Lets assume we have a HR system and the user has got deleted in the system, the HR system drop a CSV file to a specified location with the details of the user to be deleted from the IDM system . Now the CSV GTC connector would need to read the record and delete the user .
    This can be done , I have done this using API calls , but i assume that there would be someway of doing this using the OOB GTC .I think we need to set the correct value for the status field to do this ..
    I am not sure what status to set.

  • Issue trying to use a Sharepoint document library as a network drive on which a software can create and delete content

    Hi,
    With my colleagues we are using a dictation/transcription software which automatically creates files, moves them from folders to folders and deletes them. Until now, all this was done on a network drive, but the drive will soon be unavailable and
    we will eventually have to use a SharePoint document library instead, and I am currently testing this option.
    I have created a document library (with no versioning and no check out required) and I mapped it as a drive in Windows Explorer to link the SharePoint folders with the dictation software. Everything seems to work fine except
    for one thing: when the dictation software tries to move files from one folder to another, the files are pasted in the destination folder but not deleted from the original folder and an error message pops up saying "delete operation has failed".
    So the softaware is able to automatically create new content in the document library but is unable to automatically delete (I can however delete manually through the software interface).
    Any idea on what is causing this issue and how to solve it?
    Thank you

    Hi,
    According to your description, my understanding is that the documents cannot be deleted in the original folder when using the software with SharePoint library.
    I recommend to verify the things below:
    Which credential did you use to map the document library as network drive?
    If the credential was windows logon, then I recommend to check if the documents can be deleted in the network drive which was connected to SharePoint library directly.
    If the documents can be deleted in the network drive which was connected to SharePoint library, then the issue may be due to the compatibility problem between the software and WebDAV. Then you need to check the issue using third-party software provider.
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Creating and Accessing a Dynamic View Object

    Hi,
    I'm needing to create a Dynamic View Object so to have the ability to modify the FROM and WHERE clauses in an SQL statement.
    I then need to view all the columns and rows in an adf table or something similar.
    I've read up a fair bit on similar situations, however I'm struggling with the basic framework of building the View Object.
    I know I'm wanting to use ..createViewObjectFromQueryStmt..but just unsure of the syntax in using it, especially connecting the VO to an Application Module.
    This is similar to what I've got now, located in AppModuleImpl.java
        public void createDynVO(ApplicationModule appMod, String FROMclause, String WHEREclause){
        String SQL = "SELECT JOURNAL_NAME, PERIOD_NAME FROM " + FROMclause + " " + WHEREclause;
        ViewObject vo = appMod.createViewObjectFromQueryStmt("DynamicView", SQL);
        vo.executeQuery();But how does it know what the application module is?
    Any help would be greatly appreciated!
    -Chris

    Ok, I've actually modified my approach to this.
    I've created a View Object in the design view, added it to the App Module, and then created an iterator and bound an adf table to that iterator.
    The View Object which I created has the same column names as what I am going to be getting later down the track.
    Everything is working perfectly, except that I can't seem to bind variables to the WHERE clause.
    Below is what I have got running:
        public void recreateDynView(String FromClause, String whereCompany, String whereDepartment) {
             String sql_PAGE_ITEM1 = " AND PAGE_ITEM1 LIKE :P_PAGE_ITEM1";
             String sql_PAGE_ITEM2 = " AND PAGE_ITEM2 LIKE :P_PAGE_ITEM2";
             findViewObject("DynamicView1").remove();
             String SQLStmt = "SELECT PAGE_ITEM1, PAGE_ITEM2, PAGE_ITEM3, LINE_ITEM FROM " + FromClause;
             ViewObject vo = createViewObjectFromQueryStmt("DynamicView1",SQLStmt);
             vo.setWhereClause("1=1");
               if (whereCompany != null && whereCompany.length()>0){
                   vo.setWhereClause(vo.getWhereClause() + sql_PAGE_ITEM1);
                   vo.defineNamedWhereClauseParam("P_PAGE_ITEM1",null,null);
                   vo.setNamedWhereClauseParam("P_PAGE_ITEM1",whereCompany);
               if (whereDepartment != null && whereDepartment.length()>0){
                   vo.setWhereClause(vo.getWhereClause() + sql_PAGE_ITEM2);
                   vo.defineNamedWhereClauseParam("P_PAGE_ITEM2",null,null);
                   vo.setNamedWhereClauseParam("P_PAGE_ITEM2",whereDepartment);
             vo.executeQuery();
           }However whenever I input a value into one of the bound variables, I get the following error on the page.
       1. JBO-29000: Unexpected exception caught: oracle.jbo.InvalidOperException, msg=JBO-25070: Where-clause param variable P_PAGE_ITEM1 needs ordinal index array.
       2. JBO-25070: Where-clause param variable P_PAGE_ITEM1 needs ordinal index array.In the view object which i created at design stage, I've set the binding style to Oracle Named, so it should be alright. But obviously since I'm removing the view object and creating another version of it, it doesn't have the same binding style attached by default?
    Is there a work around for this? I'm so close!
    -Chris

  • Create and execure a dynamic query

    hi all,
    i'm trying to write a procedure in order to create a dinamyc query and calculate a certain value.
    i coded something like this but it does not work:
    create or replace procedure CALCOLA_OPERAZIONE
    is
    sql_stmt varchar2(2000);
    colonna varchar2(2000);
    tabella varchar2(2000);
    fattore varchar2(2000);
    parametro number;
    bt number := 0;
    cursor cur is
    select cod_colonna,cod_tabella,fattore_bt from table;
    begin
    open cur;
        loop
            fetch cur into colonna,tabella,fattore;
            sql_stmt := 'select :1 * :2 into parametro from :3';
            EXECUTE IMMEDIATE sql_stmt USING colonna,fattore,tabella;
            bt:=bt+parametro;
        end loop;
    close cur;
    EXCEPTION
    WHEN OTHERS THEN
          raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
    end;here the error i get:
    An error was encountered - -903 -ERROR- ORA-00903: invalid table namecan anyone help me?
    Edited by: 908335 on 6-feb-2012 1.30

    The good news is that what you want to do should be possible, but you need to take a different approach.
    The bad news is that I agree with the others and think you need to take a step back and think about whether this is a good design. Dynamic SQL is a difficult solultion to implement and (within reason) static sql is almost always more maintaintable.
    Still, if you're doing this as an exercise for your own knowledge or an assignment the technique is something like what I will put below (it will be untested). You will need to build the sql as text, execute it, and get the results. I prefer reference cursors for this kind of work although EXECUTE IMMEDIATE can be used. The solution will look something like (beware typos)
    declare
      ref_cursor sys_refcursor;
      col           varchar2(32767);
      sql_text    varchar2(32767);
      value       varchar2(1);
    begin
      col := 'dummy';
      sql_text := 'select '||col||' from dual';
      open ref_cursor using sql_text;
      fetch ref_cursor into value;
      close ref_cursor;
    end;I will leave it up to you to figure out how to adapt what you have to work like this :)

  • Create and Load Chart dynamically  in Flex

    Hi Friends,
    I want to create the chart dynamically [N numbers] . I try
    to create one line chart and add line series by action script , but
    i stuck up at how to embed that chart object in mxml code. I want
    to load the [action script created ] chart in canvas container.
    Plz help me if u have any ideas ,
    thanks
    ksam.

    what i would like to have is like this...
    XML Template :
    <class name="TaskA" getters="true" setters="true">
    <properties name="id" type="java.lang.Long" defaultValue="0"/>
    <properties name="name" type="java.lang.String" defaultValue="null"/>
    <properties name="priority" type="java.lang.Integer" defaultValue="3"/>
    </class>
    And using some java code i could generate a class at runtime, the prototype of which would be something like this...
    public class TaskA {
    java.lang.Long id=0;
    java.lang.String=null;
    java.lang.Integer priority=3;
    ..................... //Getters and Setters of the properties.
    }

  • New library has been created and deleted all old photos

    After the update I was asked something about creating a new library, then there was a countdown and the iphoto app is now empty of all photos.
    I have checked whether it has just created a new library but it hasn't, I also cannot find my iphoto library anywhere not Macbook.  Photos from over four years have simply vanish ... please help!!!

    No, there is absolutely no sign of them!
    do you know what the string would be to do a search i.e. ; .jpg or .doc etc...

Maybe you are looking for

  • Opening a video in Windows Media Player

    How do you open a video in Windows Media Player? The video I'm trying to open in Windows Media Player is an avi file. I noticed that in the Authorware 7 book, it says to simply add a wmp after "avi". For ex: myvideo.avi.wmp It then says to place or i

  • Re: Roku and Vizio TV won't stream netflix or other video

    Suddenly FiOS won't let me use ROKU.

  • Show source folder name within Aperture

    Is it possible, within Aperture, to see where the actual image is stored on my hard drive? ie, the path and folder structure? I would think it would be an option when the bottom viewer is set up to show the columns of text (rather than images)... Or

  • How to assign particular condition to particular po

    Hi, I want to assign one particular condition parocedure to my particular Po. how its possible. give me complete details about it. Sydanna

  • How to delay stream

    hi all is there any suggestion of how to delay streaming between source and destination database i have site A to stream it in Site B but not immediately , i want to delay it to define date time.