The functionality of the knockout simplegrid is very limited so you need to add this functionality yourself.
You have to extend the "ko_simpleGrid_grid"
template and add a style
binding on the gnerated td
with:
<tr data-bind=\"foreach: $parent.columns\">\
<td data-bind=\"text: typeof rowText == 'function' ? \
rowText($parent) : $parent[rowText], style: $data.cellStyle \"></td>\
</tr>\
And now you can pass in any valid style
binding value with:
columns: [
{ headerText: "Item Name", rowText: "name" },
{ headerText: "Sales Count", rowText: "sales",
cellStyle: { textAlign: "center" } },
{ headerText: "Price",
rowText: function (item) { return "$" + item.price.toFixed(2) } }
],
Demo JSFiddle.