Catch a restore event when Sharepoint 2010 webpart is in minimize mode.

Respondido Catch a restore event when Sharepoint 2010 webpart is in minimize mode.

  • sexta-feira, 27 de abril de 2012 18:42
     
     

    Hello All,

    I have a SharePoint 2010 web part in minimize mode, what I want is when I click on restore in the menu of the minimize menu options , I should be able to capture that event.

    Screen Shot:  http://imgur.com/HiERI

    I am trying to get an event when this restore option is selected. Any Any help will be appreciated.

    Regards

    Rahul

Todas as Respostas

  • sexta-feira, 27 de abril de 2012 19:58
     
     Resposta Proposta

    I think that is you looking for:


    Just add JavaScript script which finds menuitem with id="MSOMenu_Restore" (inside specified webpart if so) and modify it's onmenuclick attribute according to your requirements. jQuery helps you!


    Don't happy, be worry...

    • Sugerido como Resposta Aviw_ segunda-feira, 30 de abril de 2012 19:23
    •  
  • segunda-feira, 30 de abril de 2012 18:46
     
     Respondido Contém Código

    I found a solution for what I was looking for, while doing it I found few things about SharePoint, I am not sure if they apply everywhere but I found them interesting enough to share,

    •  Click events cannot be attached to verbs in menu items.
    • There were times when I found that I can select elements by using pure JavaScript rather than using Jquery [I am still confused why this happens].

    Well solution turned up to be pretty simple for the question, I used a mouseup instead of click and i could capture it,

          
    $('#MSOMenu_Restore').live('mouseup',function(){alert('trexx')});

    Thanks ,

    Rahul

    • Marcado como Resposta Rahul_999 segunda-feira, 30 de abril de 2012 18:47
    •  
  • terça-feira, 1 de maio de 2012 18:37
     
     Resposta Proposta Contém Código

    Now we need to handle the possibility that the user opens the menu, then uses arrow keys and return to select the option.  Is there a peer to mouseup that would handle a keypress? 

    $('#MSOMenu_Restore').live('keypress',function(){alert('foo')});

    $('#MSOMenu_Restore').live('keyup',function(){alert('foo')});

    $('#MSOMenu_Restore').live('keydown',function(){alert('foo')});

    do not seem to be working.

    • Sugerido como Resposta veda123 terça-feira, 16 de outubro de 2012 16:24
    •