I am unable to understand your question.
Please share screenshot to explain further.
This is my code:
<?php
require __DIR__."/../../resources/phpgridorg/config.php";
require __DIR__."/../../resources/phpgridorg/lib/inc/jqgrid_dist.php";
// set up DB
mysqli_connect(PHPGRID_DBHOST, PHPGRID_DBUSER, PHPGRID_DBPASS);
mysqli_select_db(PHPGRID_DBNAME);
// Database config file to be passed in phpgrid constructor
$db_conf = array();
$db_conf["type"] = PHPGRID_DBTYPE;
$db_conf["server"] = PHPGRID_DBHOST; // or you mysql ip
$db_conf["user"] = PHPGRID_DBUSER; // username
$db_conf["password"] = PHPGRID_DBPASS; // password
$db_conf["database"] = PHPGRID_DBNAME; // database
// pass connection array to jqgrid()
$g = new jqgrid($db_conf);
// $grid["url"] = ""; // your paramterized URL — defaults to REQUEST_URI
$grid["rowNum"] = 10; // by default 20
$grid["sortname"] = 'id'; // by default sort grid by this field
$grid["caption"] = "Sales"; // caption of grid
$grid["width"] = 1110; // expand grid to screen width
$grid["height"] = 100; // expand grid to screen width
$grid["multiselect"] = true; // allow you to multi-select through checkboxes
$grid["resizable"] = true;
$grid["altRows"] = true;
$grid["form"]["position"] = "center";
$grid["form"]["nav"] = true;
$g->set_options($grid);
$g->set_actions(array(
"add"=>false, // allow/disallow add
"edit"=>true, // allow/disallow edit
"delete"=>true, // allow/disallow delete
"rowactions"=>true, // show/hide row wise edit/del/save option
"export"=>true, // show/hide export to excel option
"autofilter" => true, // show/hide autofilter for search
"search" => "advance" // show single/multi field search condition (e.g. simple or advance)
)
);
$opt["add_options"]["success_msg"] = "Post added";
$opt["edit_options"]["success_msg"] = "Post updated";
$opt["delete_options"]["success_msg"] = "Post deleted";
// for bulk editing
$opt["edit_options"]["success_msg_bulk"] = "Post(s) updated";
$opt["edit_options"]["checkOnSubmit"] = true;
$g->set_options($opt);
// set database table for CRUD operations
$g->table = "sales_temp";
$col = array();
$col["title"] = "ID"; // caption of column
$col["name"] = "id"; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
$col["width"] = "12";
$cols[] = $col;
$col = array();
$col["title"] = "Item Name"; // caption of column
$col["name"] = "item_name"; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
$cols[] = $col;
$col = array();
$col["title"] = "Quantity"; // caption of column
$col["name"] = "qty"; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
$col["width"] = "32";
$cols[] = $col;
$col = array();
$col["title"] = "Unit Price"; // caption of column
$col["name"] = "unit_price"; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
$col["width"] = "32";
$cols[] = $col;
$col = array();
$col["title"] = "Amount"; // caption of column
$col["name"] = "amount"; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
$col["width"] = "32";
$cols[] = $col;
// pass the cooked columns to grid
$g->set_columns($cols);
// render grid and get html/js output
$out = $g->render("list");
?>
I need to refresh the Sub Total div/text box value after deleting the row.
Before Delete:
———————–
Inline image 2
After Delete second row:
————————————-
Inline image 3
<div id="sub_total_div">
<input name="txtSubTotal" type="text" id="txtSubTotal" size="15" value="<?php
$sql=mysqli_query($connection,'select sum(amount) from sales_temp');
$row = mysqli_fetch_array($sql);
echo $row[0];
?>"/>
</div>
Please help me. Can I do this by changing the delete function of php grid?