Welcome Guest Search | Active Topics | Sign In | Register

Treeview Refresh Options
Arul
Posted: Tuesday, December 16, 2008 2:42:58 PM
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
eo_support
Posted: Wednesday, December 17, 2008 6:28:49 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
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
Arul
Posted: Wednesday, December 17, 2008 6:36:22 AM
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
eo_support
Posted: Wednesday, December 17, 2008 6:52:46 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
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!
Arul
Posted: Wednesday, December 17, 2008 7:06:45 AM
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
eo_support
Posted: Wednesday, December 17, 2008 7:12:49 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
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
Arul
Posted: Wednesday, December 17, 2008 9:27:57 AM
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
eo_support
Posted: Wednesday, December 17, 2008 11:25:18 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
That's a good idea. :)


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.