Welcome Guest Search | Active Topics | Sign In | Register

Callback + Splitter + TreeView Options
Marco
Posted: Friday, May 13, 2011 11:44:00 AM
Rank: Member
Groups: Member

Joined: 4/15/2011
Posts: 19
I've got a tree populateondemand in a splitter.

I want that:
- clicking on node -> generate populateondemand;
- clicking on leaf -> splitterpane collapse.

I put my tree inside CallbackPanel2, so if i click on node only tree is generated.
I put my splitter inside CallbackPanel1, so if i click on leaf i call from c# the treepane collapse.

This is the code, everything works, but splitterpane doesn't collapse. I don't understand how to set the codebehind as triggers of CallbackPanel1.

Code: HTML/ASPX
<eo:CallbackPanel runat="server" id="CallbackPanel1" Triggers="{ControlID:TVABD;Parameter:}">

   <eo:Splitter ID="Splitter" runat="server" >

      <eo:SplitterPane ID="TreePane" runat="server" State="Visible">

         <eo:CallbackPanel runat="server" id="CallbackPanel2" ChildrenAsTriggers="true">

            <eo:TreeView ID="TVABD" runat="server" RaisesServerEvent="True"  
            onitempopulate="TVABD_ItemPopulate" OnItemClick="TVABD_ItemClick" >
               <LookNodes>
                  <eo:TreeNode ItemID="_Default"/>
               </LookNodes>
            </eo:TreeView>

         </eo:CallbackPanel>

      </eo:SplitterPane>

      <eo:SplitterPane ID="ContentPane" runat="server">
         ...
      </eo:SplitterPane>

   </eo:Splitter>

</eo:CallbackPanel>


Code: C#
protected void TVABD_ItemClick(object sender, EO.Web.NavigationItemEventArgs e)
{
   if (e.TreeNode.Value.ToString() != "")
      TreePane.State = EO.Web.SplitterPaneState.Collapsed;
   else
      TreePane.State = EO.Web.SplitterPaneState.Visible;
}


Thanks for help!
eo_support
Posted: Friday, May 13, 2011 11:56:53 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You won't be able to have the same control triggering two nesting CallbackPanels at the same time. The best way for you to update your splitter is to call the splitter's client side JavaScript interface directly:

Code: JavaScript
function item_click(e, info)
{
    //Get the splitter control
    var splitter = eo_GetObject("Splitter");

    //Get the left pane
    var pane = splitter.getLeftPane();

    //Collapse the left pane
    pane.setState(1);
}


Code: HTML/ASPX
<eo:TreeView ClientSideOnItemClick="item_click" ....>
...
</eo:TreeView>


This is much more efficient because there is no roundtrip back to the server (note you no longer need RaisesServerEvent on the TreeView). There are also many other objects/methods available on the client side. You can take a look of the reference section for more details. If you have not used our client side interface before, this topic is a good starting point:

http://doc.essentialobjects.com/

Hope this helps.

Thanks


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.