Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
How can i stop items from becoming Active?
posted

Hiya,

I have a WebDataMenu (EnableAppStyling=true) for which I trigger various actions via OnItemClick.  When an item is clicked, it is selected (becomes active) and is highlighted as such; a feature I do not want.

I've looked around for a Javascript function i could use to unselect, or a property that lets me stop selection but have had no luck so far.  Obviously I could change the css on highlighting to hide the aesthetics, but is there a better way to do this rather than overriding the app styling?

Cheers,
Stafford.

Parents
No Data
Reply
  • 4493
    Verified Answer
    posted

    Hello Stafford,

    You could achieve your target by handling a couple of client-side events:

    <

     

     

    First you have to cancel the selection from ItemSelecting event:

    ClientEvents ItemSelecting="iSelecting" ItemClick="iClick" ItemCollapsed="iCollapsed" />

     

     

    function

     

    iSelecting(menu, args) {
        var item = args.getItem();
        args.set_cancel(
    true);
    }

    Then, remove the "active" state of an item, which just closed:

     

     

    function

     

    iCollapsed(menu, args) {
       var item = args.getItem();
       item.set_active(
    false);
    }

    And finnaly a little hack for non-parent items:

     

     

     

     

     

    function iClick(menu, args) {
        var item = args.getItem();
        var f = function() { item.set_active(false);
        window.setTimeout(f, 50);
    }

    I hope this will help you!

Children
No Data