[#49,transform,bugfix][s]: be careful about selecting col for transform code as may have no fields as yet.
This commit is contained in:
parent
bef8f9ff00
commit
0c767212e2
@ -44,7 +44,11 @@ my.Transform = Backbone.View.extend({
|
||||
// Put in the basic (identity) transform script
|
||||
// TODO: put this into the template?
|
||||
var editor = this.el.find('.expression-preview-code');
|
||||
var col = this.model.fields.models[0].id;
|
||||
if (this.model.fields.length > 0) {
|
||||
var col = this.model.fields.models[0].id;
|
||||
} else {
|
||||
var col = 'unknown';
|
||||
}
|
||||
editor.val("function(doc) {\n doc['"+ col +"'] = doc['"+ col +"'];\n return doc;\n}");
|
||||
editor.focus().get(0).setSelectionRange(18, 18);
|
||||
editor.keydown();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user