Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6474263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:34:01+00:00 2026-05-25T06:34:01+00:00

my web application is based on dojo 1.6.0. The problem that I have is

  • 0

my web application is based on dojo 1.6.0.
The problem that I have is based on event handlers basically and/or their utilization
in dojos “dojox.grid.EnhancedGrid” library.

My application contains a dojox Enhanced Grid with a great number of rows. (100+)

This Enhanced Grid makes use of the “cellMenu”-Plugin to show a context menu
for each Grid Cell on right click.

My goal is to use the context menu for “smart” selection of rows.

For example:

The user right clicks on a cell wich is positioned in the column “lastname” and has the value “miller”. He then clicks “smart select” in the context menu.
The application will then loop over the row data and select all rows wich have “miller” as “lastname”.
In the aftermath the user will innitiate actions with the selected rows through press of a button.

Here is a small sourcecode example illustrating the declarative approach for visualization of the Enhanced Grid with Context Menu:

<table dojoType="dojox.grid.EnhancedGrid" plugins="{cellMenu:'myMenu'}">
<div id="myMenu" dojoType="dijit.Menu">
  <div id="mi1" dojoType="dijit.MenuItem">Do something with this cell</div>
  <div id="mi2" dojoType="dijit.MenuItem">Do something else with this cell</div>
</div>
<thead>
  definition of columns
</thead>
</table>

Action code is handled separate from the visualization in js-Files:

<script type="text/javascript">
dojo.addOnLoad(function(){
  dojo.connect(dijit.byId('mi1'),'onClick',function(event){ 
    //Use Data from the cell clicked to do something
  });
  dojo.connect(dijit.byId('mi2'),'onClick',function(event){
    //Use Data from the cell clicked to do something else
  });
});
</script>

I am relatively new to dojo and do not have experience with the handling of the EnhancedGrid.

So my problem is the following:

When I click inside the context-menu which is a “dijit.Menu” the “onClick” event
of the “dijit.MenuItem” contained therein is triggered.

Inside this event handler I need to read the contents of the “Grid Cell” the context menu
was opened on, but I do not have (or do not currently know) a way to get a reference to the “Grid Cell”.

With default tactics I might be able to get a reference to the MenuItem and from there maybe to the Menu, but I was unable to find an attribute containing the reference to the “Grid Cell” or a row/column ID that would enable me to access the Cell clicked.

Since context menus are there to do something with the “item” they were opened with by right clicking I think that there has to be a way (as meant by the designer) to access this “item”.

I have not yet found a documentation or example illustrating this and would appreciate all your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:34:01+00:00Added an answer on May 25, 2026 at 6:34 am

    Here is a possible sollution (maybe not the best there is) for using a context menu on a dojo grid for selection purposes:

    Visual Part (Declarative)

    <table id="grid" dojoType="dojox.grid.EnhancedGrid"
      plugins="{indirectSelection:true,menus:{cellMenu:'GridCellMenu'}}">
      <div dojoType="dijit.Menu" id="GridCellMenu" style="display:none;">
        <div dojoType="dijit.MenuItem" id="mi_selectSimilar">select similar items</div>
        <div dojoType="dijit.MenuItem" id="mi_deSelectSimilar">DEselect similar items</div>
      </div>
      <thead>
        <tr>
          <th field="id">ID</th>
          <th field="lastname">Lastname</th>
          <th field="firstname>firstname</th>
        </tr>
      </thead>
    </table>
    

    JavaScript Background

    // Stylesheets and Dojo Groundwork are neglected in this example
    
    <script type="text/javascript">
      dojo.require('dijit.Menu');
      dojo.require('dijit.MenuItem');
      dojo.require('dojox.grid.EnhancedGrid');
      dojo.require('dojox.grid.enhanced.plugins.IndirectSelection');
      dojo.require('dojox.grid.enhanced.plugins.Menu');
    
      var currentEvent = null;
    
      var fn_selectSimilar = function(){
        var data = currentCell.grid.store.objectStore.data;
        dojo.forEach(data,function(row,idx){
          if(row[currentEvent.cell.field] == data[currentEvent.rowIndex][currentEvent.cell.field]){
            currentEvent.cell.grid.selection.addToSelection(idx);
          }
        }
      }
      var fn_deSelectSimilar = function(){
        var data = currentEvent.cell.grid.store.objectStore.data;
        dojo.forEach(data,function(row,idx){
          if(row[currentEvent.cell.field] == data[currentEvent.rowIndex][currentEvent.cell.field]){
            currentEvent.cell.grid.selection.deselect(idx);
          }
        }
      }
    
      dojo.addOnLoad(function(){
        dojo.connect(dijit.byId('grid'),"onCellContextMenu",function(e){
          currentEvent = e;
        });
        dojo.connect(dijit.byId('mi_selectSimilar'),"onClick",fn_selectSimilar);
        dojo.connect(dijit.byId('mi_deSelectSimilar'),"onClick",fn_deSelectSimilar);
      });
    
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web-based application that notifies users of activity on the site via
We have a web application that is based around a form that gets passed
I have a small web application based on asp.net 2010 that manages invoices. After
We have a requirement to control access to our SaaS based web application based
The web-based application I’m currently working on is growing arms and legs! It’s basically
I have a web-based application which is very highly reliant on jquery / javascript,
i just completed a web based chat application based on ajax/php. But the problem
We have a legacy web application (not Spring based) and are looking for best
I have to use custom functions / objects in my web application based on
My web application is based on Google Maps API and I have problems trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.