Try this.
success: function (data) {
ko.utils.arrayForEach(data, function(item){
item.label = ko.computed(function () {
return item.code + ' (' + item.cls + ')';
});
});
//..........
}
Fiddle: http://jsfiddle.net/8WqQu/1/
Or as Anders noted, you could simply do this.
success: function (data) {
ko.utils.arrayForEach(data, function(item){
item.label = item.code + ' (' + item.cls + ')';
});
//..........
}
Fiddle: http://jsfiddle.net/8WqQu/2/