enyo.DividerSupport
CSS
.divider {
padding: 4px;
border-top: 1px dotted black;
border-bottom: 1px dotted black;
}
JavaScript
enyo.DividerSupport = {
name: "enyo.DividerSupport",
//* @public
//* a component declaration representing the control to be created for each divider
divider: null,
//* the property on the model that varies. changes in it between records will cause a new divider to be added
dividingProperty: "",
//* accepts a function or function name that will be bound to the owner of the Repeater. divide has precedence over dividingProperty
divide: "",
//* @protected
add: enyo.inherit(function(sup) {
return function(rec, i) {
this.addDivider(rec, i);
sup.apply(this, arguments);
};
}),
getItemOffsetIndex: function(index) {
var cc = this.getClientControls();
for(var i=0,l=cc.length;i<l;i++) {
var c = cc[i];
if(c.isDivider) {
index++;
}
if(i == index) {
return index;
}
}
return -1;
},
remove: function(i) {
// get the row to be removed
var index = this.getItemOffsetIndex(i);
if(index >= 0) {
var controls = this.getClientControls();
var c = controls[index];
var pc = controls[index-1];
var nc = controls[index+1];
// if the previous control is a divider and either there
// isn't a next control or the next control is a divider
if(pc && pc.isDivider && (!nc || nc.isDivider)) {
// remove the previous divider
pc.destroy();
}
// destroy the requested control
c.destroy();
}
},
addDivider: function(rec, i) {
// if a divider isn't declared and neither dividingProperty or
// a divide function isn't declared, do nothing
if(!(this.divider && (this.dividingProperty ||...