Jump to content

UniPanel.UniGrid has ContextMenu disabled (disabling works when rows present) - Blank Rows still pops up ContextMenu - How to prevent ?


andyhill

Recommended Posts

When Grid shows no rows the user can still invoke ContextMenu, if Grid contains row(s) then my current coding below disables ContextMenu.

How do we prevent Grid ContextMenu with zero rows ? Please advise - thanks

  //////////////////////////////////////////////////////////////////////////////
  // Before Container
  MyScript:= 'beforecontainercontextmenu=function beforecontainercontextmenu(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) '#13#10 +
             '{ '#13#10 +
             '  e.preventDefault(); '#13#10 +
             '} ';
  grdWorkSheet.ClientEvents.ExtEvents.Add(MyScript);
  // Container
  MyScript:= 'containercontextmenu=function containercontextmenu(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) '#13#10 +
             '{ '#13#10 +
             '  e.preventDefault(); '#13#10 +
             '} ';
  grdWorkSheet.ClientEvents.ExtEvents.Add(MyScript);
  // Row
  MyScript:= 'rowcontextmenu=function rowcontextmenu(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) '#13#10 +
             '{ '#13#10 +
             '  e.preventDefault(); '#13#10 +
             '} ';
  grdWorkSheet.ClientEvents.ExtEvents.Add(MyScript);
  // Before Cell
  MyScript:= 'beforecellcontextmenu=function beforecellcontextmenu(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) '#13#10 +
             '{ '#13#10 +
             '  e.preventDefault(); '#13#10 +
             '} ';
  grdWorkSheet.ClientEvents.ExtEvents.Add(MyScript);
  // Cell
  MyScript:= 'cellcontextmenu=function cellcontextmenu(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) '#13#10 +
             '{ '#13#10 +
             '  e.preventDefault(); '#13#10 +
             '} ';
  grdWorkSheet.ClientEvents.ExtEvents.Add(MyScript);
  // Before Item
  MyScript:= 'beforeitemcontextmenu=function beforeitemcontextmenu(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) '#13#10 +
             '{ '#13#10 +
             '  e.preventDefault(); '#13#10 +
             '} ';
  grdWorkSheet.ClientEvents.ExtEvents.Add(MyScript);
  // Item
  MyScript:= 'itemcontextmenu=function itemcontextmenu(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) '#13#10 +
             '{ '#13#10 +
             '  e.preventDefault(); '#13#10 +
             '} ';
  grdWorkSheet.ClientEvents.ExtEvents.Add(MyScript);
  // Header
  MyScript:= 'headercontextmenu=function headercontextmenu(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) '#13#10 +
             '{ '#13#10 +
             '  e.preventDefault(); '#13#10 +
             '} ';
  grdWorkSheet.ClientEvents.ExtEvents.Add(MyScript);

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...