Skip to content

Instantly share code, notes, and snippets.

@motohasystem
Created February 29, 2024 02:55
Show Gist options
  • Save motohasystem/33f5f33db7fef9cf0a371c1d60a52cc7 to your computer and use it in GitHub Desktop.
Save motohasystem/33f5f33db7fef9cf0a371c1d60a52cc7 to your computer and use it in GitHub Desktop.
clickable_cell.js
(function () {
"use strict";
var invoiceNumberFieldCode = "インボイス登録番号"; // ここにインボイス登録番号のフィールドコードを設定
kintone.events.on("app.record.index.show", function (event) {
var records = kintone.app.getFieldElements(invoiceNumberFieldCode);
console.log(records);
// レコードリストの各セルにイベントリスナーを設定
records.forEach(function (cell) {
if (cell) {
console.log(cell);
cell.style.cursor = "pointer";
cell.addEventListener("click", function () {
try {
var tempTextArea = document.createElement("textarea");
tempTextArea.value = cell.textContent;
document.body.appendChild(tempTextArea);
tempTextArea.select();
document.execCommand("copy");
document.body.removeChild(tempTextArea);
alert("クリップボードにコピーしました!");
} catch (err) {
console.error("コピーに失敗しました: ", err);
}
});
}
});
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment