I've used scrollsettings FrozenColumns property, to freeze the first column. It partially worked, as I observed the generated grid with frozen column working, however, the error still popped up on the setModel method, about "Cannot read property showStackedHeaders of null". It seems, this way of initializing frozen column is not intended, and doesnt work correctly with my stacked headers.
<input type="button" id="stack" />
<input type="button" id="frozen" />
<div id="Grid"></div>
<script type="text/javascript">
$(function () {
$("#stack").ejButton({
text: 'EnableStackedheader', click: function () {
$("#Grid").ejGrid("option", {
stackedHeaderRows: [{
stackedHeaderColumns: [{ headerText: "Order Details", column: "OrderID,OrderDate,Freight" }
, { headerText: "Ship Details2", column: "ShipName,ShipCity,ShipCountry" }
],
},
],
})
}
})
$("#frozen").ejButton({
text: 'EnableFrozen', click: function () {
$("#Grid").ejGrid("option", { scrollSettings: { width: 450, height: 300, frozenColumns: 2, frozenRows: 2 },
})
}
})
// the datasource "window.gridData" is referred from jsondata.min.js
$("#Grid").ejGrid({
dataSource: window.gridData,
allowPaging: true,
allowSorting: true,
allowScrolling: true,
showStackedHeader: true,
columns: [
{ field: "OrderID", headerText: "Order ID", width: 75, textAlign: ej.TextAlign.Right },
. . .
]
});
}); |