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 6746485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:19:42+00:00 2026-05-26T12:19:42+00:00

I am using a third-party control (Aspose.Cells.GridWeb). It is basically a web based Excel

  • 0

I am using a third-party control (Aspose.Cells.GridWeb). It is basically a web based Excel control. When a user selects a cell, the onCellSelected event is raised by the control.

The thing is, I need to know what key was pressed by the user to cause this event to be raised. I need this information to determine how to handle the event.

I am using JQuery’s keydown event to capture the button clicked.

    $(document).keydown(function(event) {
        isKeyLastClicked = true;
        keyLastClickedId = event.which;
        isMouseButtonLastClicked = false;
        mouseButtonLastClickedId = null;
    });

The problem is that the control’s onCellSelected event is raised BEFORE the keydown event is raised. Is this expected behavior?

Is there any way to get the id of the key before the control’s event is raised?

Thanks in advance.

  • 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-26T12:19:43+00:00Added an answer on May 26, 2026 at 12:19 pm

    After a long discussion at the SO chat…
    Since binding the keydown event does not produce the desired results, you have to alter the onCellSelected function. It should follow the next pattern:

    1. When onCellSelected is triggered for the first time, the first argument (cell) is assigned to a (temporary) variable.
    2. Then, when a keydown event occurs, the key code is checked:
      • If the pressed key (ev.which or ev.keyCode) equals a certain key, the onCellSelected function is called again, passing the value of the temporary variable as a first argument.
      • Else, the temporary variable is cleared, since it makes no sense to remember it.

    The code would have the following structure. Modify it to suit your application:

    var lastCell = null;
    function onCellSelected (cell) {
        if(lastCell == null) {
            lastCell = cell;
            return; //Wait for the next listener
        }
        ... //Rest of code
    }
    
    $(document).keydown(function(e){
        if(lastCell == null) return; //No need to do unnecessary calculations
        //Whatever you want, example:
        if(e.keyCode == 32) {
            onCellSelected(lastCell);
            lastCell = null; //Reset
        }
        ... //Rest of code
    });
    

    Note: keyCode, charCode and which, see also: http://asquare.net/javascript/tests/KeyCode.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using a third-party Windows Forms control that performs some actions delayed using
I am using Aspose cells to manipulate Excel spreadsheets. One of the types in
I want to control PUSH notification own, without using third party server like for
Without using a third-party control, is it possible to automatically begin uploading a file
I'm developing a web application in Java and I'm using several third party JAR
I'm coming from a ASP.NET Webforms application. I'm using a third party control from
When using third-party libraries such as jquery, yui-reset, swfobject and so on, do you
What is the simplest way (preferably without using third party frameworks) in objective c,
Is it possible in IE8 without using third party plugin like Java?
How can I detect keyboard event in C language without using third party libraries?

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.