• suhas Vasudevamurthy
    December 15, 2019 at 3:29 am #5609

    Hi All,

     

    Im Trying to append a row to a table which is bound to a complex BO as shown below

    var autoObject = [];
    autoObject[0] = {};
    autoObject[0].cust = {};
    autoObject[0].cust.name = “”;
    autoObject[0].cust.age = “”;
    autoObject[0].cust.sex = “”;
    autoObject

    This is bound to table

    On click of a button we are trying to append a row to the table using the code below in on-click event of a button.

    code to append a row:

    ${sampletable1}.appendElement({ name:”Suhas”,age:”29″,sex:”male”});

    On click of the button, an empty row is appended without any data that was set using the code above.

    when we bind the table to a simple complex object list, the functionality works fine,

    Is there any specific was to reference the element of a complex object stated above?

    P.S I have already tried cust.name, cust/name and it doesn’t work

    SPARK Support
    December 16, 2019 at 9:40 am #5610

    Hello Suhas,

    If the Table control is bound to a complex object, each row is an object.  Table1.add() and Table1.add( {} ) are equivalent, and create a new blank row.  If you want to populate your row with values, the property names must be added to the statement Table1.add( { property1:value1, property2:value2 } ).

    However, your object is defined with property1, property2, complex1, and complex1 has subProperty1, subProperty2.  Your add statement needs to reference the complex object inside the row: Table1.add( {property1:value1, property2:value2, complex1: {subProperty1:subValue1, subProperty2:subValue2} } );

    Regards,

    Stephen P

    suhas Vasudevamurthy
    December 17, 2019 at 1:44 am #5611

    Thanks a lot Stephen.

    The solution you provided works as expected

    SPARK Support
    December 17, 2019 at 7:18 am #5612

    You are welcome.

    Regards,

    Stephen P

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Start typing and press Enter to search