• Binary
    August 29, 2019 at 1:42 am #5542

    Hi there,

    I got a table where I would like to set default values for new added rows. I saw that I can set an event which triggers when you add a row but how can I adress the last added element?

    Thanks!

     

    SPARK Support
    August 29, 2019 at 6:37 am #5544

    Hi Binary,

    In order to add a record that is not blank, the On Add Row By User event needs to return a JavaScript objection matching the structure of the Business Object bound to the Table.  For instance, in my test harness, I have a complex type list containing two Strings, a Decimal, an Integer and a Date.  By placing the following code in the Add Row event, the new row is populated with some mock data based on the current record count:

    var count = me.getRecordCount(); return {str1: “String” + count.toString(), str2: “Test”, dec1:count/3, int1: 10 + count, date1: new Date()};

    Regards,

    Stephen P.

    Lalitha Vempati
    September 18, 2019 at 12:23 am #5555

    Hi Stephen,

     

    I have a requirement like in a table I have a button and when button is clicked the corresponding row should be selected and a screen should be shown with details about the item clicked. The table control does not select the row unless we use a selection column. I’m trying to systematically select the row on the On click event in the button control that I have as one column. The code I am using is:

    this.visibility=function(me){
    var index=me.ui.getIndex();
    var getrecord=me.ui.getParent().getRecord(index,false);

    me.ui.getParent().setRecordSelected( getrecord, true, true);

    I am calling visibility function on Onclick event of button control inside table like

    @visibility(me.ui.getIndex());

    Here i am able to get record selected using “var getrecord=me.ui.getParent().getRecord(index,false);”, the problem is on setting the record selected to table listselected using “me.ui.getParent().setRecordSelected( getrecord, true, true);” which is giving undefined when trying using that code.

    Could you please help me with this.

    Thanks in advance.

    SPARK Support
    October 1, 2019 at 10:56 am #5574

    Hi Lalitha.

    If you have the index of the record, why not use table.setRecordSelected(index) ?

    Regards,

    Stephen P.

    Binary
    February 12, 2020 at 1:55 am #5662

    Thank you!

    I tried the following:

    On row add by user:
    return {farmServername:"abc"};

    This works fine. In the field farmServername of the table, the value abc is added on each new line.
    Now I try to copy the data auf the first row:

    var ersteSpalte = this.ui.get('/farmServerDaten/farmServername[0]').getData();
    return {farmServername:ersteSpalte};

    This does not work. Tried different variations.

    Edit: This worked:

    var rowData = me.getRecord(0);
    return {farmServername:rowData.farmServername, farmServerIpAdresse:rowData.farmServerIpAdresse, farmServerPort:rowData.farmServerPort, activeBackup:rowData.activeBackup};

    I’m just curios why

    var rowData = me.getRecord(0);
    return rowData;
    

    Is not enough?

    • This reply was modified 7 months, 2 weeks ago by Binary. Reason: Wrote the solution
    SPARK Support
    February 13, 2020 at 8:26 am #5672

    Hi Binary,

    If you inspect the object returned from getRecord(), you will see that there is more information contained in the record to coordinate functionality with the Table control.  The JSON object does not match exactly what the Table is looking for to create a new record.  This is why you need to form the structure of the object in JSON format and provide the exact properties from the object you have retrieved.

    Regards,

    Stephen P.

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

You must be logged in to reply to this topic.

Start typing and press Enter to search

istanbul escort ilanlari istanbul escort istanbul escort bayanlarla sevgili tadinda etkilesimler. istanbul escort bayanlar istanbul escort istanbul escort hizmeti icin ideal web sitesi.