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