I have implemented loading on demand for items at the "Child Node" level so it would automatically pull the sub-items when that node is expanded (using ServerSideCallBack) which works great. I have also implemented a context menu for each "Child Node" entry that has an "Add Category" option which adds a new item (at the Sub Node level) so a new entry can be added. This entire process works great and is surprisingly versatile.
The only issue I have is when the new item is added I want all the "Sub Node" entries for the parent "Child Node" item to be re-bound so the items appear in alphabetical order. I tried using the set_expanded() methods but it seems once a node has been expanded the items are cached and there isn't a way to forcefully tell it to go get the items again. Basically I'm looking for a client-side method call that tells the "Child Node" entry that it needs to go get a fresh copy of items once the adding process is complete.
Any idea on how to make this happen?
function
rowContextMenu(sender, eventArgs) {
var
menu = $find(
"<%= menuDrivers.ClientID %>"
);
var
evt = eventArgs.get_domEvent();
if
(evt.target.tagName ==
"INPUT"
|| evt.target.tagName ==
"A"
)
return
;
// Get trip ID + type from source row
var
index = eventArgs.get_itemIndexHierarchical();
var
row = sender.Control.children[1].children[0].rows[parseInt(index)];
var
rowElements = row.getElementsByTagName(
"input"
);
alert(sender);
alert(
'Row index '
+ index +
' clicked. Trip ID is '
+ rowElements[0].value);
// Store the trip ID and type in hidden fields
$get(
"ContextTripID"
).value = rowElements[0].value;
$get(
"ContextTripType"
).value = rowElements[1].value;
// more code continues here ...
}