- newRow.find('td:first').append(selectView.el);
- metadataKeys.forEach(function(key) {
- selectView.addItem(key);
+ newRow.find('td:first').append(keySelectView.el).data('view', keySelectView);
+
+
+ var valueSelectView = new OpenSelectView({
+ value: row.getValue(),
+ inputTemplate: _.template('<div class="openInput rng-module-metadataEditor-metaItemValue" contentEditable="true"><%= value %></div>')({value: row.getValue() || '' }),
+ setInput: function(inputDOM, value) {
+ if(inputDOM.text() !== value) {
+ inputDOM.text(value);
+ row.setValue(value);
+ }
+ }
+ });
+ newRow.find('td:nth-child(2)').append(valueSelectView.el).data('view', valueSelectView);
+
+
+ metadataConfig.forEach(function(configRow) {
+ keySelectView.addItem(configRow.key);
+ if(row.getKey() === configRow.key) {
+ (configRow.values || []).forEach(function(value) {
+ valueSelectView.addItem(value);
+ });
+ }