Closed xuqingkuang closed 12 years ago
@zhizhangchen Set a break point at ADMNode.prototype.setProperty() and set the condition to 'property == "id"', then drop a checkbox group into canvas you will see:
Update the checkbox group ID is trigger by ModelUpdated event, it catches by projectView's _modelUpdatedHandler(), then it use findNodesByProperty() to traverse the children checkboxes, and use generateUniqueProperty() to generate ID.
The problem is generateUniqueProperty() generate correct IDs - checkbox1, checkbox2 and checkbox3, but findNodesByProperty() returns the nodes reversed - node3, node2, node1.
So it applied incorrect IDs - node3 applied 'checkbox1', node2 applied 'checkbox2' and node1 applied 'checkbox3'.
In fact, I have no idea why here traverse the node reversed, traverse in order maybe work too.
BTW: The function only called in project.js so far.
$ grep -nr findNodesByProperty * src/js/adm.js:1475:ADMNode.prototype.findNodesByProperty = function (propertyFilter) { src/js/adm.js:1491: result = result.concat(children[i].findNodesByProperty(propertyFilter)); src/js/projects.js:1023: matched = node.findNodesByProperty($.rib.pmUtils.relativeFilter);
(Because we didn't address the real problem, this bug could resurface if something changes that gets the ID properties accessed before we get to this function.)
Merged.
Why is the problem related to findNodesByProperty?