[index.cshtml]
col.Field("Freight").HeaderText("Freight").Edit(new { create = "create_Freight", read = "read_Freight", destroy = "destroy_Freight", write = "write_Freight" }).Width("120").AllowEditing(false).Add();
col.Field("ImageCol").HeaderText("").Template("#ImageTemplate").Edit(new { create = "create_ImageCol", read = "read_ImageCol", destroy = "destroy_ImageCol", write = "write_ImageCol" }).AllowEditing(false).Width("150").Add();
<script type="text/x-template" id="ImageTemplate">
<img style="height: 30px;" class="photo" src=https://ej2.syncfusion.com/javascript/demos/src/grid/images/${EmployeeID}.png alt="${EmployeeID}" />
</script>
<script>
var
freightElem
function
create_Freight(args) {
freightElem =
document.createElement('div');
return freightElem;
}
function write_Freight(args)
{
args.element.innerText =
args.rowData[args.column.field];
}
function
destroy_Freight(args) {
freightElem.remove();
}
function
read_Freight(args) {
return
parseFloat(freightElem.innerText);
}
var imageColElem
function
create_ImageCol(args) {
imageColElem =
document.createElement('div');
return imageColElem;
}
function
write_ImageCol(args) {
}
function
destroy_ImageCol(args) {
imageColElem.remove();
}
function
read_ImageCol(args) {
return "";
}
</script>
|