When I select information in the drop-down list.
I want to change the table in exactly the information selected above.
Sample code for table manipulation methods ?
When I select information in the drop-down list.
I want to change the table in exactly the information selected above.
Sample code for table manipulation methods ?
Hi NewTum
This forum provides support for those people who are working on Kintone customizations.
With that in mind, please provide a sample code of what you have tried out so far so that others can support you.
btnUpdate.addEventListener(‘click’, function() {
swal({
title: ‘Select your supplier’,
input: ‘select’,
inputOptions: selectOBJ,
inputPlaceholder: ‘Select supplier’,
showCancelButton: true,
inputValidator: function (value) {
return new Promise(function (resolve) {
if (!!value) {
resolve()
} else {
resolve()
}
})
}
}).then(function (result) {
if (!!result.value) {
itemOBJ = new Array();
var resultKey = result.value;
if (tableRecords.length > 0) {
for (var i = 0; i < tableRecords.length; i++) {
var checkNM = tableRecords[i].value[‘COM_NM’].value;
checkNM = (checkNM.replace(/ /g, “”)).toUpperCase();
if(resultKey == checkNM){
itemOBJ.push(tableRecords[i]);
}
}
}else{
return false;
}
var curRecord = event.record;
curRecord[‘TB_SUP’][‘value’] = itemOBJ;
}else{
console.log('result : ’ + JSON.stringify(result));
return false;
}
return event;
})
});
I tried to overwrite the original table.
Hello NewTum,
When you are trying to rewrite the value within the record on the record edit screen,
it would not be reflected even after returning the event object.
By using PUT’s API, you should be able to rewrite the record.
However, from checking the process you are trying to do, it looks like
you are trying to show only the necessary information without changing the data within the table.
I also could not tell if the information on “tableRecords.length”
was being acquired by data from different apps or data from an open record.
Do I understand this correctly? You would like to display
only the necessary information without changing any data within the table?
If that is what you are looking to do, 「kintone」API does not support that
so you would have to customize it using DOM manipulation.
If there is only one subtable, you could use this code:
document.querySelectorAll("subtable-gaia tr");
you can acquire all the rows from the subtable and if there are any
row that does not match the condition, you can non-display the “tr” element and implement it.
Using DOM manipulation:
(function () {
"use strict";
kintone.events.on(['app.record.detail.show'], function (event) {
$('table:eq(0) thead tr th:eq(2)').hide();
var tbodyTimerId = setInterval(function () {
if ($('table:eq(0) tbody tr td:eq(2)').length > 0) {
clearInterval(tbodyTimerId);
$('table:eq(0) tbody tr td:eq(2)').hide();
}
}, 100);
});
})();
Hopefully, this helps.
Sean