javascript - knockout.js foreach binding: property value to array of column names -
i have question knockout foreach binding table. i have array of columnnames , array of items . the items array has property called columnname . how use knockout foreach bind self.items self.columnnames? my view model looks this: var vm = function () { var self = this; self.items = ko.observablearray(); self.columnnames = [ "name", "age", "job"]; }; var vm = new vm(); ko.applybindings(vm); vm.items.push([ { 'columnname': 'name', 'value': 'john' }, { 'columnname': 'age', 'value': 25' } ]); vm.items.push([ { 'columnname': 'name', 'value': 'jane' }, { 'columnname': 'age', 'value': 26 }, { 'columnname': 'job', 'value': 'developer' } ]); ...