JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdn.jsdelivr.net/npm/handsontable@12.3/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable@12.3/dist/handsontable.full.min.css" />
<script src="https://handsontable.com/docs/scripts/fixer.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<div id="data-table" class="hot nested handsontable htColumnHeaders" style="margin-top:20px"></div>
CSS
.handsontable .truncated {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
JavaScript
const container = document.getElementById('data-table');
const aData = [
{users:'Claire', notes:'She is considering to join us.\n\She will let us know by5/1'},
{users:'Jenny', notes:'She lives in san fransico,\n\She does not want to relocate'},
{users:'Tom', notes:'He wants to join us \n\as soon as possible'},
]
const columns = [
{ data: 'users', title:"User", width:100, readOnly: false},
{ data: 'notes', title:"Notes", width:200, readOnly: false, className:'WordWrap'},
]
const hot = new Handsontable(container, {
data: aData,
columns: columns,
manualColumnResize: true,
cells: function(row, col, prop ) {
const cellPrp = {};
cellPrp.renderer = customRenderer;
return cellPrp;
},
afterColumnResize: afterColumnResize,
})
function customRenderer(instance, td, row, col, prop, value, cellProperties){
Handsontable.renderers.TextRenderer.apply(this, arguments);
if( prop == 'notes'){
$(td).addClass('truncated');
}
}
function afterColumnResize(newSize, col){
if( col == 1){
$(hot.getCell(0 ,col)).removeClass('truncated');
hot.getCellMeta(0, col).change = true;
}
}