OK, here it is a small snippet of code (ExtJs 4):
var TestA = function() {}
TestA.prototype.createCheckboxes = function() {
var items = [
{boxLabel: "A", inputValue: "A", name: "smthng"},
{boxLabel: "B", inputValue: "B", name: "smthng"}
];
var chgroup = new Ext.form.CheckboxGroup({items:items})
return chgroup;
}
var a = new TestA().createCheckboxes().items.get(0).getManager();
var b = new TestA().createCheckboxes().items.get(0).getManager();
console.log(a, b, a == b)
As far as I can see, we are creating different instances of Ext.form.CheckboxGroup. Nevertheless, inspecting shows that created items are using same manager. Is it intentional and how can I get rid of such behaviour? Since I want to have “different” checkbox groups not affecting each other (loadRecords on one form affects another)
This is intentional. CheckboxManager is a singleton and nothing more than a “collection of all checkboxes in your DOM” with some wrapper functions
To achieve what you want (activity in one group should not affect others) you will have to make sure that the checkbox name attributes are distinct between your various checkbox groups.
i.e. If group A has checkbox(es) “smthng”, group B can have “smthng else” but not “smthng”.
(This also makes sense from design perspective since if they have the same name, there is really no distinction between “smthng” in group A and “smthng” in group B.)