3.2.0

Clear AW Controls from Container

For example, I have a container control like this and one input control to accept the name. Based on the name, I create dynamic objects and associate to container.
var container = new AW.HTML.SPAN;
document.write(container);

var obj_label = new AW.UI.Label;
obj_label.setId("obj_label");
obj_label.setControlText("Name");
document.write(obj_label);

var obj_input = new AW.UI.Input;
obj_input.setId("obj_input");
obj_input.setControlText("");
document.write(obj_input);

I put all the dynamic AW object controls inside an array and associate with the container:
var contents = [obj1_input, obj2_input, obj3_label, ....]; //obj2_input, obj3_label objects are dynamically created with ids are same as object name.
container.element().innerHTML = contents.join("");

When user tries to change the input (enters some other data, while the objects in the current page is displayed), I clear the contents array and display a fresh page
contents = [];
container.element().innerHTML = contents.join("");
After I clear the array, I associate new objects to the container and contents.

But when I try to get the id, of previous object, I am able to get, even after clearing the contents. I think, I still am not removing the object completely, but only from the array.
var tmp_obj_id = AW.object('obj1_input');
if(tmp_obj_id != undefined){
alert(tmp_obj_id.getControlText());
}

Is there to completely remove the old objects and its id?

I appreciate your response on this

Thanks
VJ
July 15,
AW keeps internal reference to all objects with assigned id. This is how AW.object(id) works. The reference is located in AW.all array. To remove this reference assign null to AW.all[id].

AW.all[id] = null;
Alex (ActiveWidgets)
July 15,
Wow! This is cool.
Thanks a lot Alex for helping me on this. It now works great. It now clears the old object references.

Thanks
VJ
July 15,

This topic is archived.

See also:


Back to support forum