Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#12369 closed defect (fixed)

[regression] right click context menu doesn't work anymore in EnhancedGrid

Reported by: Eric Pasquier Owned by: evan
Priority: high Milestone: 1.6.1
Component: DojoX Grid Version: 1.6.0rc1
Keywords: EnhancedGrid Menu Cc:
Blocked By: Blocking:

Description

The right click context menu doesn't work anymore in EnhancedGrid?.
Works on 1.5.0, 1.6.0b1 and 1.6.0b2.
Also tested that it is not working with tarball dojo-2011-02-28 ;-)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
  <title>TEST Enhanced Grid Menus</title>

<style type="text/css">
    @import "/dojo-release-1.6.0rc1-src/dijit/themes/soria/soria.css";
    @import "/dojo-release-1.6.0rc1-src/dojox/grid/resources/Grid.css";
    @import "/dojo-release-1.6.0rc1-src/dojox/grid/resources/soriaGrid.css";
    @import "/dojo-release-1.6.0rc1-src/dojox/grid/enhanced/resources/EnhancedGrid.css");

html, body {
  height:100%;
}
</style>

<script type="text/javascript">
    var djConfig = {"parseOnLoad":true};
</script>
<script type="text/javascript" src="/dojo-release-1.6.0rc1-src/dojo/dojo.js"></script>
<script type="text/javascript">
  dojo.require("dojo.parser");
  dojo.require("dojo.data.ItemFileWriteStore");
  dojo.require("dojox.grid.DataGrid");
	dojo.require("dojox.grid.EnhancedGrid");
	dojo.require("dojox.grid.enhanced.plugins.Menu");

  //========================
  // doRowClick
  //------------------------
  function doRowClick() {
    console.info("doRowClick");
  }

  dojo.addOnLoad(function() {
    dojo.connect(gridActions, "onRowClick", "doRowClick");
  });

  function doOnCellContextMenu(cell) {
    console.info("doOnCellContextMenu");
  }

  function gridRowContextMenu_Edit(param) {
    console.info("gridRowContextMenu_Edit");
  }

  function gridRowContextMenu_Copy() {
    console.info("gridRowContextMenu_Copy");
  }
</script>

 
</head>
<body class="soria">

  <script type="text/javascript">
    var dataActions = {identifier: 'id', label: 'libelle', items: [
                        {id:'1', chk1:true,  chk2:false, chk3:false, chk4:false, libelle:'Action 1'},
                        {id:'2', chk1:false, chk2:true,  chk3:false, chk4:false, libelle:'Action 2'},
                        {id:'3', chk1:false, chk2:true,  chk3:false, chk4:false, libelle:'Action 3'},
                        {id:'4', chk1:false, chk2:true,  chk3:false, chk4:false, libelle:'Action 4'},
                        {id:'5', chk1:false, chk2:true,  chk3:false, chk4:false, libelle:'Action 5'},
                        {id:'6', chk1:false, chk2:true,  chk3:false, chk4:false, libelle:'Action 6'},
                        {id:'7', chk1:false, chk2:false, chk3:true,  chk4:false, libelle:'Action 7'},
                        {id:'8', chk1:false, chk2:false, chk3:true,  chk4:false, libelle:'Action 8'},
                        {id:'9', chk1:false, chk2:false, chk3:true,  chk4:false, libelle:'Action 9'}
                      ]};
  </script>

  <!-- Store actions -->
  <div dojoType="dojo.data.ItemFileWriteStore" jsId="storeActions" data="dataActions"></div>

  <table style="height:300px;" id="tableactions" jsId="gridActions" dojoType="dojox.grid.EnhancedGrid" query="{id:'*'}" store="storeActions"
    xxonRowClick="doRowClick"
    onCellContextMenu="doOnCellContextMenu"
    plugins="{ menus:{rowMenu:'tabledata_rowMenu'} }" >

    <thead>
      <tr>
        <th width="30px" field="id" >Id</th>
        <th style="text-align:left;" width="200px" field="libelle" editable="true" >Actions</th>
        <th width="50px" field="chk1" editable="true"  >Chk 1</th>
        <th width="50px" field="chk2" editable="true"  >Chk 2</th>
        <th width="50px" field="chk3" editable="true"  >Chk 3</th>
        <th width="50px" field="chk4" editable="true"  >Chk 4</th>
      </tr>
    </thead>
  </table>

  <div dojoType="dijit.Menu" id="tabledata_rowMenu" jsId="tabledata_rowMenu" style="display:none; border: 2px solid #b1badf;">
    <div dojoType="dijit.MenuItem" onClick="gridRowContextMenu_Edit">Edit</div>
    <div dojoType="dijit.MenuItem" onClick="gridRowContextMenu_Copy">Copy</div>
  </div>

</body>
</html>

Change History (3)

comment:1 Changed 9 years ago by Bryan Forbes

Owner: changed from bryanforbes to evan

comment:2 Changed 9 years ago by evan

Resolution: fixed
Status: newclosed

(In [24054]) Always show row menu when there is no cell menu, fixes #12369, applied to both trunk and 1.6 branch

comment:3 Changed 9 years ago by evan

Milestone: tbd1.6.1

Thanks Eric, the row menu should always be shown if there were no cell menus.
BTW, in the test case, you shall use dojo.connect(gridActions, "onCellContextMenu", "doOnCellContextMenu") to make it work appropriately, not sure why it's working in < 1.6.0b2 - it shouldn't without this fix.

Note: See TracTickets for help on using tickets.