Author Topic: contextmenu on tab  (Read 2164 times)

arbyter

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 43
  • Retired IT Guy
    • View Profile
contextmenu on tab
« on: June 04, 2021, 03:53:15 pm »
hi Paramvir
i am trying to implement a context-Menu on Tab. I think, this is not basicly implemented (could not find in the API-Doc), but maybe you can give me a hint how to create it.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6210
    • View Profile
Re: contextmenu on tab
« Reply #1 on: June 04, 2021, 10:11:48 pm »
I'm not clear about which tab. Could you please share a screenshot.

arbyter

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 43
  • Retired IT Guy
    • View Profile
Re: contextmenu on tab
« Reply #2 on: June 07, 2021, 08:45:15 pm »
I would like to add a contextmenu similar to on contextMenu.headItems right on the tab.


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6210
    • View Profile
Re: contextmenu on tab
« Reply #3 on: June 08, 2021, 09:14:57 am »
Context menu is not supported outside the grid i.e., jQueryUI tabs.

In the upcoming version context menu would be supported on the integrated tabs as can be seen on the home page 2nd demo of spreadsheet.

https://paramquery.com/

arbyter

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 43
  • Retired IT Guy
    • View Profile
Re: contextmenu on tab
« Reply #4 on: June 08, 2021, 02:32:17 pm »
thank you for your reply.
I cannot find "the home page 2nd demo of spreadsheet", your link leads just to the main page.

arbyter

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 43
  • Retired IT Guy
    • View Profile
Re: contextmenu on tab
« Reply #5 on: June 08, 2021, 03:08:04 pm »
i am experimenting with contextmenu on grid: rightclick on the top-left grid corner does not deliver ui parameter. I would expect to have a grid-context ui there.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6210
    • View Profile
Re: contextmenu on tab
« Reply #6 on: June 08, 2021, 06:56:39 pm »
Please use context event.

https://paramquery.com/pro/api#event-context

ui argument has properties when context menu is activated on body cells, header cells or image, in other cases target of the context menu can be detected from evt.originalEvent.target.
« Last Edit: June 08, 2021, 06:58:19 pm by paramvir »

arbyter

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 43
  • Retired IT Guy
    • View Profile
Re: contextmenu on tab
« Reply #7 on: June 09, 2021, 03:35:39 pm »
thats what i am using. It delivers correct ui in cells, ui with -1 in rownumbers, but in the top left corner of the grid no ui is delivered.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6210
    • View Profile
Re: contextmenu on tab
« Reply #8 on: June 09, 2021, 11:23:37 pm »
That's right, ui object is empty in that region.

Please add miscItems in contextMenu option to define context menu on that region:

Code: [Select]
miscItems: function(evt, ui){
if( $(evt.originalEvent.target).is(".pq-grid-number-cell")){
//return menu items here.
return [{
    name: 'test',
    action: function(){
alert('test');
}
}]   
}
},
« Last Edit: June 10, 2021, 12:13:55 pm by paramvir »