Active.HTTP.Request.prototype.response = function(data){
if (this.$owner) {
this.$owner.setRowProperty("value", function(i){return i});
this.$owner.setRowProperty("order", function(i){return i});
this.$owner.setRowProperty("count", this.getCount());
this.$owner.setSortProperty("index", null);
this.$owner.refresh();
}
}
Active.Controls.Grid.prototype.setAction("dataChanged", function() {
// set data count
var newCount = this.currentRoles.length;
this.setDataProperty("count", newCount);
// clear internal row state
var rowValues = [];
for(var i=0; i < newCount; ++i) { rowValues.push(i); }
this.setRowProperty("values", rowValues);
this.setSortProperty("index", null);
// clear selection - if required
this.setSelectionProperty("index", -1);
this.setSelectionProperty("values", []);
this.refresh();
});
...
function changeData() {
// change the myData - add/edit/delete
// tell grid about new size (remember using setDataProperty)
obj.setDataProperty("count", myData.length);
obj.action("dataChanged");
}
...
Active.Controls.Grid.prototype.setAction("dataChanged", function() {
var newCount = this.getDataProperty("count");
// clear internal row state
var rowValues = [];
for(var i=0; i < newCount; ++i) { rowValues.push(i); }
this.setRowProperty("values", rowValues);
this.setSortProperty("index", null);
// clear selection - if required
this.setSelectionProperty("index", -1);
this.setSelectionProperty("values", []);
this.refresh();
});
This topic is archived.