背景・実現したいこと
ページネーション非表示のカスタマイズビューで小計欄を追加したいです。
参考にしたサイト②はページネーションを表示した場合のコードですので非表示の場合のコードが知りたいです。
参考にしたサイト
** ** ① 第10回 kintone REST APIを利用したレコード取得 – cybozu developer network
② kintone)レコード一覧画面 集計について – cybozu developer network
利用したソースコード
【HTML】(信号機アプリを使用)
<div id="my-customized-view">
<table border="1">
<thead>
<tr>
<th>レコード番号</th>
<th>信号機</th>
<th>作成日時</th>
<th>小計</th>
</tr>
</thead>
<tbody id="my-tbody">
</tbody>
<tfoot>
<tr>
<td id="goukei"></td>
</tr>
</tfoot>
</table>
【JS】
(() => {
'use strict';
kintone.events.on('app.record.index.show', (event) => {
if (event.viewName !== 'カスタム') {
return;
}
// リクエストパラメータ
const requestParam = {
'app': kintone.app.getId(),
'query': kintone.app.getQuery()
};
// カスタマイズビューにレコード表示
const myDisplayCustomizedView = records => {
if (records.length === 0) {
document.getElementById('my-customized-view').innerText = '表示するレコードがありません';
return;
}
const recUrl = location.protocol + '//' + location.hostname + '/k/' + kintone.app.getId() + '/show#record=';
const myRecordSpace = document.getElementById('my-tbody');
myRecordSpace.innerText = '';
for (let i = 0; i < records.length; i++) {
const record = records[i];
const row = myRecordSpace.insertRow(myRecordSpace.rows.length);
const cell1 = row.insertCell(0);
const cell2 = row.insertCell(1);
const cell3 = row.insertCell(2);
const cell4 = row.insertCell(3);
const tmpA = document.createElement('a');
tmpA.href = recUrl + record.レコード番号.value;
tmpA.innerText = record.レコード番号.value;
cell1.appendChild(tmpA);
cell2.innerText = record.信号の色.value;
const createdAt = new Date(record.作成日時.value);
cell3.innerText = createdAt.toLocaleString();
cell4.innerText = record.小計.value;
}
};
kintone.api(kintone.api.url('/k/v1/records', true), 'GET', requestParam, (resp) => {
// 取得レコード: resp.records
myDisplayCustomizedView(resp.records);
});
});
})();
何方かお教え頂けますでしょうか?