Archive for the ‘KendoUI’ Category

Here’s some nice CSS that will truncate long text in a KendoUI grid and add an ellipsis on the end.

.k-grid td{
white-space: nowrap;
text-overflow: ellipsis;
}

KendoTruncate

Today I needed to format some data in a KendoUI grid. This is easily done but took me a bit to track it down. I added a template to my column declarations that needed formatting. Then used the kendo.toString formatter method.

var setupGrids = function() {
	$("#headerconditionsGrid").kendoGrid({
		height: 300,
		sortable: true,
		columns: [{
			field: "cond_type",
			title: "Condition",
		}, {
			field: "cond_value",
			title: "Value",
			template: '#= kendo.toString(cond_value, "n") #'
		}, {
			field: "ext_cond_value",
			title: "Extended",
			template: '#= kendo.toString(cond_value, "n") #'
		}, {
			field: "currency",
			title: "Currency"
		}]
	});
}