cartodb-4.42/lib/assets/javascripts/dashboard/views/public-dataset/public-table-view/public-header-view.js

38 lines
844 B
JavaScript
Raw Normal View History

2024-04-06 13:25:13 +08:00
const CoreView = require('backbone/core-view');
const template = require('./public-table-header-view.tpl');
// On the original code, this extended a more complex base class, but the public table needs no functionality
const HeaderView = CoreView.extend({
events: {
},
initialize: function () {
this.column = this.options.column;
this.table = this.options.table;
this.editing_name = false;
this.changing_type = false;
},
render: function () {
this.$el.html('');
this.$el.append(template({
col_name: this.column[0],
col_type: this.column[1],
editing_name: this.editing_name
}));
// Focus in the input if it is being edited
if (this.editing_name) {
this.$el.find('input').focus();
}
this.delegateEvents();
return this;
}
});
module.exports = HeaderView;