0
私は剣道mvcグリッドを持っていて、クライアントテンプレートを列として使用しています。スクリプトブロックを返すためにテンプレートにjavascript関数を書きましたが、動作していないようです。私もスクリプトを直接クライアントテンプレートに書き込もうとしましたが、そのスクリプトも機能しません。剣道mvc Grid ClientTemplate javascript関数が動作しない
//クライアントテンプレートのHTML
.Columns(columns =>
{
columns.Template(e =>
{ }).ClientTemplate(
"<div class='table-responsive'>" +
"<table border='0' class='table' >" +
...................................
"</table>" +
"</div>"+
"#=AlignDiv(Id)#"
);
})
// javascript関数形式にするために、文字列として
<script type="text/javascript">
function AlignDiv(Id) {
var result = "<script> $('.calDiv"+Id+"').map(function() {" +
"return $(this).Height();" +
"}).get()," +
"maxHeight = Math.max.apply(null, heights);" +
"$('.calDiv" + Id + "').height(maxHeight);" +
"alert('test')<\/script>";
return result;
}
どうもありがとう、 デニス