I'm trying to populate a checktree from one store and have the value of the checked property be filled by a store that is pulling from the users localstorage. The checktree is a treestore and the other is just a data store. In affect to keep track of what their last checkbox settings were.

I'm having an issue with after the page loads with a users previous settings. All the checkboxes are loaded correctly but then my localstorage/datastore functionality breaks and it wont let me change values again after that.

It gives the error:

Message: 'isModel' is null or not an object
Line: 53988
Char: 9
Code: 0
URI: http://localhost:/extjs/ext-all-debug.js Here is my checkchange listener:

Code:
 
listeners: {
checkchange: function (node, checked, e) {
var r = node.get('cls');
var p = node.raw.path;
if (r == 'folder' & checked == true) {
node.cascadeBy(function (n) {
if (n.data.checked == false) {
n.set('checked', true);
if (n.get('cls') != 'folder') {
storeSearch.add({
Path: n.raw.path,
Cls: n.get('cls'),
Name: n.get('text'),
Checked: checked,
ID: n.raw.ID
});
storeSearch.sync();
}
}
});
}
if (r == 'folder' & checked == false) {
node.cascadeBy(function (n) {
if (n.data.checked == true) {
n.set('checked', false);
if (n.get('cls') != 'folder') {
storeSearch.remove(storeSearch.findRecord("ID", n.raw.ID));
storeSearch.sync();
}
}
});
}
if (r != 'folder' & checked == true) {
storeSearch.add({
Path: p,
Cls: r,
Name: node.get('text'),
Checked: checked,
ID: node.raw.ID
});
storeSearch.sync();
}
if (r != 'folder' & checked == false) {
storeSearch.remove(storeSearch.findRecord("ID", node.raw.ID));
storeSearch.sync();
}
}
},
fbar: [
{ type: 'button', text: 'Select All',
handler: function () {
tree.getRootNode().cascadeBy(function (n) {
if (n.data.cls == 'folder' & n.data.checked == false) {
n.set('checked', true);
}
if (n.data.cls != 'folder' & n.data.checked == false) {
n.set('checked', true);
storeSearch.add({
Path: n.raw.path,
Cls: n.get('cls'),
Name: n.get('text'),
Checked: n.data.checked,
ID: n.raw.ID
});
storeSearch.sync();
}
});
}
},
{ type: 'button', text: 'Deselect All',
handler: function () {
tree.getRootNode().cascadeBy(function (n) {
if (n.data.cls == 'folder' & n.data.checked == true) {
n.set('checked', false);
}
if (n.data.cls != 'folder' & n.data.checked == true) {
n.set('checked', false);
storeSearch.remove(storeSearch.findRecord("ID", n.raw.ID));
storeSearch.sync();
}
});
}
}
]
this is my append listener for my tree store:

Code:
 
listeners: {
append: function (thisNode, newChildNode, index, e) {
if (newChildNode.get('cls') != 'folder' & newChildNode.isRoot() == false) {
//var s = storeSearch.findRecord('ID', newChildNode.raw.ID);
 
if (storeSearch.findRecord('ID', newChildNode.raw.ID) != null) {
newChildNode.set('checked', storeSearch.findRecord('ID', newChildNode.raw.ID).data.Checked);
}
//newChildNode.set('checked', storeSearch.findRecord('ID', newChildNode.raw.ID).data.Checked);
 
}
}
}