javascript - Cannot put a button in SlickGrid cell -


i trying put button in cells of 1 of columns , when it's clicked.

for example add these lines slickgrid example 1 (http://mleibman.github.io/slickgrid/examples/example1-simple.html)

first column array add:

    {id: "report", name: "report", field: "report", width: 40, sortable: true, formatter:reportformatter} 

then add:

      function reportformatter(row, cell, value, columndef, datacontext) {           return "<input type='button' value='show' id='reportbtn'/>";       }        $('#reportbtn').click(function() {           alert("hello");       }); 

the buttons appear in cells click event not being called ! must doing wrong can't life of me figure out can ? thanks!

use precompiled template slick grid example. add property eg. imagetrial, , in data structure fill property dynamic input button.

<script type=" " id="testtemplate"> <div class="test">     <b><%=imagetrial%></b>      <b><%=imagetrial2%></b> </div> 

dataforcell["imagetrial"] = "<button type=\"button\" onclick=\"alert('a " + 1 + "')\">s</button>";  dataforcell["imagetrial2"] = "<button type=\"button\" onclick=\"alert('b " + 2 + "')\">b</button>"; 

good luck


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -