Let's say I have hierarchical data that I display in a treeview. It's possible that a particular node might have 1000 children and I don't want to display them all, so I'm toying with the idea of paging the nodes in a tree. I would show 10 children and if there are more, the user needs to click on the next/previous buttons to see them. I've got sql paging working but I can't get the treeview to do what I want. If I do this (first code snippet), my controller gets the proper node id and page id and it returns the correct page of results back. But then the treeview shows only the 1 page of children I just requested; the rest of the hierarchy (all the parents) is lost:
If I do the second code snippet, I can keep the hierarchy and my controller gets called, but I can't figure out how to pass in the page that I'm requesting.
Any ideas?
$(
"#btnNextPage"
).click(
function
() {
var
selectedNode = treeview.select();
var
selectedNodeID = treeview.dataItem(selectedNode).id;
ds.read({
LoopID: selectedNodeID,
page: ds.page() + 1
})
});
If I do the second code snippet, I can keep the hierarchy and my controller gets called, but I can't figure out how to pass in the page that I'm requesting.
$(
"#btnNextPage"
).click(
function
() {
var
selectedNode = treeview.select();
var
testnode = treeview.dataItem(selectedNode);
testnode.loaded(
false
);
testnode.load();
});
Any ideas?