new row not showing in table after push

I create a new row and push it onto an empty table “machinesselected” when a row in another table is clicked. When I do console debug, I can see the row is added to the end of the empty table. But I don’t know why they are not shown on screen.

 

var trs = subtableSpace.getElementsByTagName(‘tr’);

 

for (let i = 1; i < trs.length; i++) {

 

      trs[i].addEventListener(‘click’, function (event) {

 

      var newRow = { value: { “company”: { type: “SINGLE_LINE_TEXT”, value: this.children[0].innerText }, “modelno”: { type: “SINGLE_LINE_TEXT”, value: this.children[1].innerText }, “serialno”: { type: “SINGLE_LINE_TEXT”, value: this.children[2].innerText }, “comments”: { type: “MULTI_LINE_TEXT”, value: “” }

                                                }

                                        };

        record[‘machinesselected’][‘value’].push(newRow);

        console.log(‘checking record…’, record);

        return event;

                                });

                        }

Hello annaylee,

 

I checked the code but could not find the issue.

 

However, since you are processing within the “kintone” event trying to set the value in the return event, this may be causing the issue.

 

If you are using addEventListener in the “kintone” event, the processing in the function will be outside the event handler.

 

In the process outside the event handler, it is necessary to set the value using the kintone.app.record.set function, so could you please check if there is an error in how you set the value?

 

Set Record Value - kintone.app.record.set():

https://kintone.dev/en/docs/kintone/js-api/get-data/get-record/#set-record-value

 

In some cases, it may be necessary to add the following function to get the current input value.

 

Retrieve record value:

https://developer.kintone.io/hc/en-us/articles/218379447-Retrieve-record-data-from-the-record-details-page

 

In addition, I wanted to ask you some things to understand the situation better.

 

1.) What event is being used since the return event; is written.

 

2.)More details regarding,

>I create a new row and push it onto an empty table “machinesselected” when a row in another table is clicked.

Do you mean a different table from the new row? Or the same table? What kind of processing do you wish to add?