JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
<link rel="stylesheet" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
<script src="http://www.jeasyui.com/easyui/datagrid-groupview.js"></script>
<table id="dtg" class="easyui-datagrid" title="Basic DataGrid" style="width:450px;height:200px"
data-options="
rownumbers:true,
singleSelect:true,
selectOnCheck:false,
checkOnSelect:false,
border:true,collapsible:true,
striped:true" pagination="true">
<thead>
<tr>
<th data-options="field:'productid'">Product</th>
<th data-options="field:'productname'">List Price</th>
<th data-options="field:'unitcost'">Unit Cost</th>
<th data-options="field:'attr1'">Attribute</th>
<th data-options="field:'status',align:'center'">Status</th>
</tr>
</thead>
</table>
<script>
$(document).ready(function(){
$('#dtg').datagrid('insertRow',{
index: 0,
row: {
productid: 'FI-SW-02',
productname: 'Another product and i have a very loooong name and should be fit on colum so you can read it',
unitcost: '190',
attr1: 'none',
status: 'NOT OKAY'
}
});
});
</script>
JavaScript
$('#dtg').datagrid('insertRow',{
index: 1, // index start with 0
row: {
productid: 'FI-SW-01',
productname: 'I have a very loooong name and should be fit on colum so you can read it',
unitcost: '90',
attr1: 'none',
status: 'OKAY'
}
});
$('#dtg').datagrid('autoSizeColumn');