var data = [ { rank: 1, company: 'Exxon Mobil', revenues: 339938.0, profits: 36130.0 }, { rank: 2, company: 'Wal-Mart Stores', revenues: 315654.0, profits: 11231.0 }, { rank: 3, company: 'Royal Dutch Shell', revenues: 306731.0, profits: 25311.0 }, { rank: 4, company: 'BP', revenues: 267600.0, profits: 22341.0 } ]; var CM = [ { title: "Rank", width: 100, dataIndx: "rank", editor: {type: "select", prepend: {"":""}, options: [{"1":"one"}, {"2": "two"}, {"3": "three"}, {"4": "four"}]} }, { title: "Company", width: 200, dataType: "string", dataIndx: "company" }, { title: "Revenues", width: 150, dataType: "float", dataIndx: "revenues", format: '#.0' }, { title: "Profits", width: 150, dataType: "float", dataIndx: "profits", format: '#.0' } ];
getData: function(ui){ return ui.$cell.find("option:selected").text() }
var rank = [{ "1": "one" }, { "2": "two" }, { "3": "three" }, { "4": "four" }];
render: function(ui) { var obj = rank.find(function(obj) { return obj[ui.cellData] ? true : false; }) return obj ? Object.values(obj)[0] : null; },
editor: { type: "select", prepend: { "": "" }, options: rank }