JSFiddle - React, Tailwind, and code Playground
by dkamburov
HTML
<script src="https://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js"></script>
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
<script src="https://cdn-na.infragistics.com/igniteui/2021.2/latest/js/infragistics.core.js"></script>
<script src="https://cdn-na.infragistics.com/igniteui/2021.2/latest/js/infragistics.lob.js"></script>
<script src="https://igniteui.github.io/help-samples/data-files/adventureworks.min.js"></script>
<link href="https://cdn-na.infragistics.com/igniteui/2021.2/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet">
<link href="https://cdn-na.infragistics.com/igniteui/2021.2/latest/css/structure/infragistics.css" rel="stylesheet">
<table id="grid"></table>
CSS
.delete-button
{
width: 100%;
font-size: 1em;
border: solid 1px #777;
font-family: 'Segoe UI', Arial, sans-serif;
color: #444;
}
.delete-button:hover
{
background-color: #d0edfa;
}
JavaScript
//Add arrays to adventureWorks datasource
for(let row of adventureWorks){
row.array = ["A", "B"]
}
let columnTemplateWorks = '{{each ${array} }}<span style=\'color: red\'>$data</div>{{/each}}';
let columnTemplateBroken = '{{each ${array} }}<span style="color: red">$data</div>{{/each}}';
$(function () {
$("#grid").igGrid({
autoGenerateColumns: false,
localSchemaTransform: false,
width: "100%",
height: "500px",
columns: [
{ headerText: "Product ID", key: "ProductID", dataType: "number", width: "10%" },
{ headerText: "Product Name", key: "Name", dataType: "string", width: "30%" },
{ headerText: "Custom Template", key: "CustomTemplate", dataType: "string", width: "20%", unbound: true, template: columnTemplateBroken }
],
primaryKey: "ProductID",
dataSource: adventureWorks
});
});
function deleteRow(rowId) {
var grid = $("#grid").data("igGrid");
grid.dataSource.deleteRow(rowId);
grid.commit();
}