This is a migrated thread and some comments may be shown as answers.

RadPanelBar and SingleExpandedItem vs. FullExpandedItem

2 Answers 108 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 03 Mar 2012, 11:54 PM
I'm trying to set up a panel bar that has the size restrictions of FullExpandedItem, but the behavior for child items of SingleExpandedItem (only one item within a group expanded at a time)

I can come really close by using FullExpandedItem, and using OnClientItemClicking where the function collpapses all the peers of of the item being clicked (if level isn't 0) and it works perfectly....unless you click on the expandhandle.

In that case, the OnClientItemClicking function is never called.

How can I either get a chance to handle the click when the expandhandle is called, or implement this whole thing a different way?

2 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
answered on 04 Mar 2012, 05:55 PM
FWIW, this seems to be working for me:

<script type="text/javascript">
  function OnClientItemClicking(sender, eventArgs) {
    var item = eventArgs.get_item();
    if (item.get_level() != 0) { //level 0 handled by FullExpandedItem mode
      if (item.get_items().get_count() != 0) {
        var parent = item.get_parent();
        for (i = 0; i < parent.get_items().get_count(); ++i) {
          var node = parent.get_items().getItem(i);
          if ((node != item) && node.get_expanded()) {
            node.collapse();
          }
        }
      }
    }
  }
 
  var old_onExpandHandleClick = Telerik.Web.UI.RadPanelItem.prototype._onExpandHandleClick;
  Telerik.Web.UI.RadPanelItem.prototype._onExpandHandleClick = function (element) {
    var panel = this.get_panelBar();
    var clickingArgs = new Telerik.Web.UI.RadPanelItemClickingEventArgs(this, element);
    panel._raiseEvent("itemClicking", clickingArgs);
 
    return old_onExpandHandleClick.apply(this, arguments);
  };
</script>
 I know it's not a general purpose solution, but given my situation:  radpanelbar in FullExpandedItem mode, and the OnClientClicking function never tries to cancel the click, it seems to work.  So far.

Question to Telerik:  would it be worthwhile to open a support ticket that clicking the expandhandle does not raise the itemClicking event?
0
Kate
Telerik team
answered on 07 Mar 2012, 01:11 PM
Hi Chris,

Indeed no event fires when you click on the expand handler of a RadPanelItem. We are already aware of this issue and it is already logged in our PITS. Below is the link where you can vote and keep track on its status:
http://www.telerik.com/support/pits.aspx#/public/aspnet-ajax/5778

All the best,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
PanelBar
Asked by
Chris
Top achievements
Rank 1
Answers by
Chris
Top achievements
Rank 1
Kate
Telerik team
Share this question
or