I would like to provide variable row height depending upon the content size. is it possible in Slickgrid?
Can you point me towards any examples?
Define this variable outside....
var tableHeight = 0;
Before creating the slick grid, use below the lines:
// 30 px for each line this will cover the header... You can adjust this value for your table.
tableHeight = dataTable.length * 30;
if(tableHeight > ($(window).height() - 400)){
$("#myGrid").height($(window).height() - 400);
}else{
$("#myGrid").height(tableHeight);
}
If user changes the screen when page is already generated, the below will resize the table based on screen and number of rows of data:
$(window).resize(function() {
// For grid height
if(tableHeight > ($(window).height() - 400)){
$("#myGrid").height($(window).height() - 400);
}else{
$("#myGrid").height(tableHeight);
}
// For grid width
$("#myGrid").width("100%");
// Resize the grid dynamically.
gridName.resizeCanvas();
});