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

  • Home
  • SEARCH
  • 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 7617807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:14:22+00:00 2026-05-31T03:14:22+00:00

I need to develop a grid using jqGrid and PHP what has 4 columns:

  • 0

I need to develop a grid using jqGrid and PHP what has 4 columns: Product, Quantity, Price and Amount. The product name is retrieved from the database. If the user edits the Quantity and Price columns, the amount cell should be changed automatically by multiplying the Quantity and Price columns. I’ve tried as follows:

var grid = $("#reportTable");

........

afterSaveCell: function (rowid, name, val, iRow, iCol) {
  grid.jqGrid("setCell", rowid, "amount", val, "");
  calculateTotal();
}

Please note that the calculateTotal() can calculate well the grand summary of the Quantity column without any error, and can show on the footer of the grid perfectly.

  • 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-31T03:14:23+00:00Added an answer on May 31, 2026 at 3:14 am

    I suppose that you use cell editing. In the case the afterSaveCell callback is really good place to update the calculated column amount based on the current values from the columns quantity and price. The corresponding code could be about the following

    afterSaveCell: function (rowid, cellname, value) {
        var quantity, price, $this;
        if (cellname === 'quantity' || cellname === 'price') {
            $this = $(this);
            quantity = parseFloat($this.jqGrid("getCell", rowid, 'quantity'));
            price = parseFloat($this.jqGrid("getCell", rowid, 'price'));
            $this.jqGrid("setCell", rowid, 'amount', quantity * price);
        }
    }
    

    The demo do almost the same, but calculate ‘total’ as the sum of ‘amount’ and ‘tax’. For the test you should modify the value from ‘amount’ or ‘tax’ column and verify that ‘total’ will be recalculated.

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

Sidebar

Related Questions

I need to develop a small CMS using PHP, and right now I'm trying
I need to develop HTTP push using php, it sends back a message to
I need to develop a process that will detect if the users computer has
I need to develop a page which has 2 dropdownlist. Options of dropdownlist 2
I need to develop an HTML5 mobile business application using PhoneGap. After finishing my
I need to develop an app that is using multithreading. Basicly, I have a
I need to develop an app that reads info from google calendar on Android.
I need to develop a similar grid to the one for searching phone numbers.
I need to develop live video streaming. I would like to do it using
I need to develop a small-medium sized desktop GUI application, preferably with Python as

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.