EasyUI Forum
October 16, 2025, 08:15:27 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Help Me, Datagrid footer rows using database MySQL  (Read 20702 times)
jenggo_jojo
Newbie
*
Posts: 3


View Profile
« on: January 07, 2013, 12:04:11 AM »

Help Me ... Give me Example footer rows using database MySQL ...
Logged
peterg
Newbie
*
Posts: 3


View Profile
« Reply #1 on: February 15, 2013, 01:25:55 AM »

hi, here my way. (notice i´m ab beginner in EasyUI )

php get data (post Insert, Update and Delete is in a other file.)
Code:
<?php
include '../include/funktion.php'// mysql conn etc.

// table
$dbtabelle 'Menue';

$page = isset($_POST['page']) ? intval($_POST['page']) : 1;
$rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;
$sort = isset($_POST['sort']) ? strval($_POST['sort']) : 'Position';
$order = isset($_POST['order']) ? strval($_POST['order']) : 'asc';

$offset = ($page-1)*$rows;

$result = array();
// Suche -------------

if(isset($_POST['Suche']) && !empty($_POST['Suche'])) {
$Suche mysql_real_escape_string($_POST['Suche']) ;

$where " WHERE   objekt_nr LIKE '%$Suche%'
OR Position LIKE '%
$Suche%'
OR Text like '%
$Suche%'
OR href like '%
$Suche%'
OR onclick like '%
$Suche%'
OR icon like '%
$Suche%'
OR QEclass like '%
$Suche%'
OR data_options like '%
$Suche%'
OR Breite like '%
$Suche%'
OR target like '%
$Suche%' ";
}
else { $where '';}

// total -------------
$rs mysql_query("SELECT COUNT(*) FROM $dbtabelle $where");
$row mysql_fetch_row($rs);
$result["total"] = $row[0];

// rows ---------------
$rs mysql_query("SELECT * FROM $dbtabelle $where ORDER BY $sort $order LIMIT $offset,$rows");

$items = array();
while(
$row mysql_fetch_object($rs)) {
array_push($items$row);
}
$result["rows"] = $items;

// SUM() for footer --------------------
$rs mysql_query("SELECT SUM(objekt_nr) AS objekt_nr, SUM(Position) AS Position FROM $dbtabelle $where");

while (
$row mysql_fetch_array($rs)) {
$entry = array( 'objekt_nr' => 'Summe''Position' => euro($row['Position']), );
$jsonData[] = $entry;
}
$result["footer"] = $jsonData;

header("Content-type: application/json");
echo 
json_encode($result);
?>
regards Peter
Logged
Punkerr
Newbie
*
Posts: 37


View Profile
« Reply #2 on: February 15, 2013, 04:06:10 PM »

Just check this post: http://www.jeasyui.com/forum/index.php?topic=1372.0
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!