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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:06:43+00:00 2026-05-25T10:06:43+00:00

I have a supposedly common problem to solve (done easily with other grid controls

  • 0

I have a supposedly common problem to solve (done easily with other grid controls I’m familiar with).
In jqgrid, i’m quite stumped.
I have a jqgrid with inline editing enabled. I would like to add some scripting so that when editing a row (or adding a new row), the value of ColumnC is automatically computed as ColumnA * ColumnB as default. The user can change the values in any column at any time. I want this value to be computed as soon as the user enters it and not wait till the data is saved.

My approach so far has been to attach a dataEvent of type “change” to ColumnA and ColumnB –

dataEvents: [
              { type: 'change', fn: function(e) {
                   var rowid = $("#myGrid").jqGrid('getGridParam','selrow');
                   var rowData = $("#myGrid").getRowData(rowid); 
                   var cell1 = rowData['ColumnA'];
                   var cell2 = rowData['ColumnB'];
                   var newValue = cell1 * cell2;
                   $("#myGrid").jqGrid('setCell', rowid, 'ColumnC', newValue);
                   } 
               },
          ]

Obviously, cell1 & cell2 don’t actually return the value but the whole cell content as already discovered by other users here How to get a jqGrid cell value. The only way to get a cell value seems to be to use a custom regex user function that strips out that value.
Apart from that, is there a better/alternate way to achieve what I need? Something as simple as jqGrid – How to calculated column to jqgrid? though obviously that won’t cut it for me since it will only displaying data and user cannot update it.

Any help would be appreciated.

UPDATE: After guidance from Oleg, I was able to extend getTextFromCell to support what I need.

            function getTextFromCell(cellNode) {
            var cellValue;
            //check for all INPUT types
            if (cellNode.childNodes[0].nodeName == "INPUT") {              
                //special case for handling checkbox
                if (cellNode.childNodes[0].type == "checkbox") {            
                    cellValue = cellNode.childNodes[0].checked.toString();  
                }
                else {
                    //catch-all for all other inputs - text/integer/amount etc
                    cellValue = cellNode.childNodes[0].value;               
                }
            }
            //check for dropdown list
            else if (cellNode.childNodes[0].nodeName == "SELECT") {         
                var newCell = $("select option:selected", cellNode);
                cellValue = newCell[0].value;
            }
            return cellValue;             
        }

        function getCellNodeFromRow(grid,rowId,cellName) {
            var i = getColumnIndexByName(grid, cellName);
            var cellValue;
            //find the row first
           $("tbody > tr.jqgrow", grid[0]).each(function() {
                //The "Id" column in my grid is at index 2...
                var idcell = $("td:nth-child(2)", this); 
                var currRowId = getTextFromCell(idcell[0])
                if (currRowId == rowId) {
                    cellValue = getTextFromCell($("td:nth-child(" + (i + 1) + ")", this)[0]);
                    return false;
                }
            });
            return cellValue;
        }

The code in getCellNodeFromRow is not the most efficient. There is a .each() loop for find the matching row node. I can see this being slow when the grid has thousands of rows. Is there a better/more efficient way to find the row node? I have the row Id already.

  • 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-25T10:06:43+00:00Added an answer on May 25, 2026 at 10:06 am

    Look at the demo from the answer. It uses cell editing, but the same technique work for inline editing too. Just click on any cell in the “Amount” column and modify the numerical value. You will see that the value in the “Total” row (footer) will be changed dynamically during the cell is still in the editing mode. I think it is what you need.

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

Sidebar

Related Questions

I have been given a problem to decrypt this text: 3e47b75000b0924b6c9ba5759a7cf15d which is supposedly
I know IE7 & IE8 supposedly have support for using multiple CSS class selectors,
I have a database (NexusDB (supposedly SQL-92 compliant)) which contains and Item table, a
I have a crash dump of an application that is supposedly leaking GDI. The
I have run into this problem: Custom Methods & Extension Methods cannot be translated
I have a repo that has two files that supposedly I changed locally. So
I have a dll project that references Microsoft.Practices.EnterpriseLibrary.Common.dll (= the dll ) from my
I have this code inside http://www.mysite.local/js/site/functions.js : $.getScript('/js/common/jquery.jsonrpc.js', $.jsonRPC.setup({ endPoint: '/api/accounts', namespace: 'mynamespace' })
the problem in short we have a lambda expression used in the Where clause,
I am finding many solutions to this seemingly common problem, but alas, none seem

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.