How can I easily swap rows in a view? I tried this but it does not work (the indexes change but the rows do not visually change):
var row = $$(id);
var index = $$(parentId).index(row);
var temp = this.getChildViews()[index + 1];
this.getChildViews()[index + 1] = row;
this.getChildViews()[index] = temp;
I was able to get this to work using addView():
moveRowDown: function (id) {
var row = $$(id);
var index = $$(this.config.id).index(row);
if (index < this.getChildViews().length - 1) {
this.addView(row, index + 1);
}
},
moveRowUp: function (id) {
var row = $$(id);
var index = $$(this.config.id).index(row);
if (index > 0) {
this.addView(row, index - 1);
}
}