Free and Open source Web Builder Framework. Next generation tool for building templates without coding
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

44 lines
988 B

var Component = require('./Component');
module.exports = Component.extend({
defaults: _.extend({}, Component.prototype.defaults, {
type: 'row',
tagName: 'tr',
draggable: ['table', 'tbody', 'thead'],
droppable: ['th', 'td']
}),
initialize: function(o, opt) {
Component.prototype.initialize.apply(this, arguments);
// Clean the row from non cell components
var cells = [];
var components = this.get('components');
components.each(function(model){
if(model.get('type') == 'cell'){
cells.push(model);
}
});
components.reset(cells);
}
},{
/**
* Detect if the passed element is a valid component.
* In case the element is valid an object abstracted
* from the element will be returned
* @param {HTMLElement}
* @return {Object}
* @private
*/
isComponent: function(el) {
var result = '';
if(el.tagName == 'TR'){
result = {type: 'row'};
}
return result;
},
});