列の 1 つのセルにボタンを配置し、クリックされたときに何かを実行しようとしています。
たとえば、これらの行を SlickGrid の例 1 ( http://mleibman.github.io/SlickGrid/examples/example1-simple.html )に追加します。
最初に列配列に追加します。
{id: "Report", name: "Report", field: "Report", width: 40, sortable: true, formatter:reportFormatter}
次に追加します:
function reportFormatter(row, cell, value, columnDef, dataContext) {
return "<input type='button' value='show' id='reportBtn'/>";
}
$('#reportBtn').click(function() {
alert("hello");
});
ボタンはセルに表示されますが、クリック イベントは呼び出されません。私は何か間違ったことをしているに違いありませんが、私の人生では理解できません。誰か助けてもらえますか? ありがとう!