View Full Version : Scrolling to new tree item

19 Nov 2012, 9:01 AM
We have a form field with a button that creates a new branch in our tree panel. How do I make it scroll to the new branch so its not out of view?

create: function (form, data) {
var store = main.down('#treearray').store;
var root = store.getRootNode(), i, childCount, refNode;
data.JobId = jobId;
for (i = 0, childCount = root.childNodes.length; i < childCount; i++) {
if (data.Name < root.childNodes[i].get('Name')) {
refNode = root.childNodes[i];

//main.down('#treearray').scroll("b", 0);
//insertBefore uses appendChild if refNode is null
root.insertBefore(data, refNode);

20 Nov 2012, 5:15 AM
Has anyone done this before?

Also of note, we're currently using 4.1.1

26 Nov 2012, 5:47 AM
If anyones interested, I upgraded to 4.1.3 so I can use focusNode() which did the trick.