Created
February 29, 2024 02:55
-
-
Save motohasystem/33f5f33db7fef9cf0a371c1d60a52cc7 to your computer and use it in GitHub Desktop.
clickable_cell.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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