event.preventDefault();
                                       event.stopPropagation();

Why these lines doesnt work?

In DataGrid you can overdrive the onBrowserEvent2(){} but it is fired after
the onBrowserEvent(){}
and i think is why my code doesnt work.


Is there another w3c validation pass way to do this?


Thank you.

2012/3/6 Daniel Mauricio Patino León <[email protected]>

> Hey  Sachin  thank you.
>
>
> Do you know if this property has cross browser support?
>
>
> 2012/3/6 Sachin Shekhar R <[email protected]>
>
>> In the application html file ensure you have set up body tag like - <body
>> *oncontextmenu="return false;"*>
>> This suppresses the *default *browser context menu.
>>
>>
>> On Tuesday, 6 March 2012 09:26:13 UTC+5:30, Daniel Mauricio Patino León
>> wrote:
>>>
>>> Iam trying to figure out how to implement a right click to my
>>> DataGrid, here is my code:
>>>
>>> @UiField(provided=true) DataGrid<EmployeeProxy> dataGrid = new
>>> DataGrid<EmployeeProxy>(){
>>>                 protected void onBrowserEvent2(Event event) {
>>>                         switch (DOM.eventGetType(event)) {
>>>                             case Event.ONMOUSEDOWN:
>>>                                 if (DOM.eventGetButton(event) ==
>>> Event.BUTTON_RIGHT) {
>>>
>>>
>>>                                         event.preventDefault(**);
>>>                                         event.**stopPropagation();
>>>
>>>
>>>                                    PopupPanel pop = new
>>> PopupPanel(true);
>>>
>>>                                    MenuBar menuBar = new MenuBar(true);
>>>                                    menuBar.setVisible(true);
>>>                                    menuBar.addItem(new MenuItem("Click
>>> me", new Command() {
>>>
>>>                               **                  @Override
>>>                               **                  public void execute()
>>> {
>>>                               **                          
>>> **Window.alert("Clicked
>>> me!");
>>>                               **                  }
>>>                               **             }));
>>>                                    menuBar.addItem(new MenuItem("Poke
>>> me",new Command(){
>>>                                            @Override
>>>                               **                          **public void
>>> execute() {
>>>                               **                              **    
>>> Window.alert("Poked
>>> me!");
>>>                               **                          }
>>>                                    }));
>>>
>>>                                    pop.setWidget(menuBar);
>>>
>>>
>>> pop.setPopupPosition(DOM.**eventGetClientX(event)
>>> ,DOM.eventGetClientY(event));
>>>                                    pop.show();
>>>
>>>                                 } else {
>>>                                     super.onBrowserEvent2(event);
>>>                                 }
>>>                                 break;
>>>                             default:
>>>                                 super.onBrowserEvent2(event);
>>>                                 break;
>>>                     }
>>>                 };
>>>         };
>>>
>>>
>>> This works ok but dont know how to prevent the default browser right
>>> click behavior.
>>>
>>>
>>> Any help would be nice. Thank you.
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Google Web Toolkit" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/google-web-toolkit/-/fKgliG4HeB4J.
>>
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>
>
>
> --
> ISC. Daniel Mauricio Patiño León.
> Director ejecutivo
> Liondev S.A. de C.V.
>
>
>
>


-- 
ISC. Daniel Mauricio Patiño León.
Director ejecutivo
Liondev S.A. de C.V.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to