+
+ var keySelectView = new OpenSelectView({
+ value: row.getKey() || '',
+ inputTemplate: _.template('<div class="openInput rng-module-metadataEditor-metaItemKey" contentEditable="true"><%= value %></div>')({value: row.getKey() || '' }),
+ setInput: function(inputDOM, value) {
+ if(inputDOM.text() !== value) {
+ inputDOM.text(value);
+ row.setKey(value);
+ }
+ valueSelectView.clearItems();
+ getValuesForKey(value).forEach(function(value) {
+ valueSelectView.addItem(value);
+ });
+ }
+ });
+ 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() || '' }),
+ maxHeight: '300px',
+ maxWidth: '100px',
+ 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);
+ });
+ }
+ });
+