|
Rank: Advanced Member Groups: Member
Joined: 11/17/2008 Posts: 20
|
Hi
I am using a treeview control and callback panel in my page .
On page load , the tree view control is populated dynamically based on the user and the work order allocated to that user . When the node in the tree view is clicked , it populates details of the work order in the call back panel.
My question is if i want to repopulate the tree view dynamically as the user clicks the node , how do i do it and how can i refresh the tree view automatically .
There's a seperate thread which keeps allocating the workorders .I wanted to display the work orders as soon as its allocated for the user . So is there any other way that i can refresh the tree view .
Now if i repopulate the treeview on click of the node , it doesnt refresh
Please help
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Obviously it won't. :) For any web development, in order to refresh a control, you reload the page. If you do not wish to reload the whole page, you use AJAX such as our CallbackPanel or ASP.NET AJAX UpdatePanel to reload the portion of the page that contains the region you wish to update. Populate on demand is an exception to this because the control itself uses AJAX underneath. However it only updates child nodes of the expanded node and nothing else. So the general rule for your control to be updated is that you change it first, then reload it. Merely changing it is not enough.
In your case, that means you will need to either have the page post back completely, or have the TreeView placed inside CallbackPanel or UpdatePanel. We do not provide user specific solution to our clients, nor do we troubleshoot our client’s code. So you may want to try this in a separate page to see how it works first. Once you get that working, you can put it together with other functionalities such as the work order list.
Hope this helps.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 11/17/2008 Posts: 20
|
Ok..can i use 2 call back panels in the same page with the trigger to one treeview item
As i have already explained , the treeview click is associated with a callback panel which populates the details
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You will not be able to trigger both CallbackPanel simultaneously. However you can trigger them sequentially. Specifically, you would trigger the first one, and when the first one is done, trigger the second one. Usually you can achieve this by handling the CallbackPanel’s ClientSideAfterUpdate event. For example:
Code: HTML/ASPX
<eo:CallbackPanel id="CallbackPanel1"
OnExecute="CallbackPanel1_Execute"
ClientSideAfterUpdate="trigger_callback2">
....
</eo:CallbackPanel>
Code: C#
//Usually you do not need to handle the CallbackPanel's Execute
//event. However if you do not wish to refresh the whole TreeView
//all the time, you will need to tell the client code WHEN you want
//to refresh the TreeView and when you do not want to refresh
//the TreeView
protected void CallbackPanel1_Execute(CallbackEventArgs e)
{
//If you want to refresh the TreeView, tell the client by setting
//e.Data to "refresh_tree". Note you can use whatever value
//here
if (ShouldRefreshTree())
e.Data = "refresh_tree";
}
Code: JavaScript
//Check the data we passed from Execute event handler. If
//we see "refresh_tree", then we should trigger the second
//CallbackPanel to refresh the TreeView.
function trigger_callback2(callback, extraData)
{
if (extraData == "refresh_tree")
{
//Do not call eo_Callback directly from here. Use
//window.setTimeout to delay the call so that the normal
//flow for the first CallbackPanel finishes first
window.setTimeout(
function()
{
eo_Callback('CallbackPanel2');
}, 10);
}
}
Hope this helps. Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 11/17/2008 Posts: 20
|
Thanks..
I just have one small doubt . Which do you think is the best practice when you associate a callback panel to a tree view and populate the values inside a callback panel
a) to capture the Callback panel's execute event and call the function to populates the values
or
b) to capture the tree click event and call the function to populates the values
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
B is generally better because it’s easier to use. But for the case outlined above where the CallbackPanel needs to pass additional data to the client, A is the only choice because B does not have such capability.
Nothing prevents you from using both, though.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 11/17/2008 Posts: 20
|
Excellent.. It worked like a charm..
I was wondering why you havent added any Timer control in your product list which can be used to trigger the call back
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
That's a good idea. :)
|
|