© Сделано на LiveStreet
Дизайн - ©2009 MODx RED Group

include($modx->config['base_path']."assets/modules/tablegear/include/tablegear.php");
$options = array();
$options["database"] = array();
$options["pagination"] = array();
$options["database"]["name"] = "***";
$options["database"]["username"] = "****";
$options["database"]["password"] = "***";
$options["database"]["table"] = "tmc";
// -- noAutoQuery (for custom queries)
$options["database"]["noAutoQuery"] = true;
// -- fetchEmptyRow (for custom defaults)
$options["database"]["fetchEmptyRow"] = true; //отключить автозаполнение если не выполняется sql условие
$options["formatting"]["kol"] = "currency[suffix=шт]";
$options["formatting"]["num"] = "currency[prefix=№ ,thousands=]";
// -- Добавление суммы
$options["totals"] = array("kol");
$options["pagination"]["perPage"] = 30; // 10 rows per page.
$options["pagination"]["prev"] = "prev"; // "prev" link will be shown.
$options["pagination"]["next"] = "next"; // "next" link will be shown.
// $options["pagination"]["linkCount"] = 2; // 2 links on each side of the current page.
//---------------------------------
$doc_id = $_GET['docid']; //айди документа
//print_r ("id-".$doc_id);
//------список выпадающий---------------
$doc_parent = $modx->getParent($doc_id,1,'id'); //получаем id родителя документа
$tmc_parent = $modx->getAllChildren($doc_parent[id],'menuindex','ASC','id,pagetitle'); //получаем массив параметров документа
//переводим массив в одномерный
foreach ($tmc_parent as $item) {
$_tmc_parent[$item['pagetitle']] = $item['id']; };
//print_r ($_tmc_tip);
$options["selects"] = array("parent" => $_tmc_parent ); //создаем выпадающие списки из наших массивов
//--------------------------------------------
$options["showAddNewRow"] = true; //добавить новую строку
$options["defaultFields"] = array("kol" => "1","parent" => $doc_id); // значения по умолчанию
$options["columns"] = array("kol" => "kol","parent" => "parent");
$options["headers"]["parent"]= "За кем закреплено";
$options["headers"]["tip"]= "Тип";
$options["headers"]["name"]= "Название";
$options["headers"]["num"]= "Инв./номенкл. №";
$options["headers"]["kol"]= "Кол.";
// Instanciates the table. This must be included here!
$table = new TableGear($options);
// If you need to use a custom query instead of the default (fetching everything), you can specify it here.
// You can use any syntax in the query you want, however you MUST include the primary key field in the SELECT
// clause, otherwise none of the editing functionality will work! Also, if you need pagination on the table
// you MUST include "SQL_CALC_FOUND_ROWS" after the SELECT clause and not have any LIMIT or ORDER BY clauses!
//
$doc_where = 'WHERE parent='.$doc_id;
if ($doc_id == '') {$doc_where = '';}
$table->fetchData("SELECT SQL_CALC_FOUND_ROWS id,parent,tip,name,num,kol FROM tmc ".$doc_where );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>TableGear for jQuery</title>
<script type="text/javascript" src="/assets/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/assets/modules/tablegear/javascripts/tablegear-jquery.js"></script>
<link type="text/css" rel="stylesheet" href="/assets/modules/tablegear/stylesheets/tablegear.css" />
</head>
<body>
<div>
<?= $table->getTable() ?>
</div>
<?= $table->getJavascript("jquery") ?>
</body>
</html>
mm_widget_evogallery (2,'Таблица');
include($modx->config['base_path']."assets/modules/tablegear/include/tablegear.php");
$options = array();
$options["database"] = array();
$options["pagination"] = array();
$options["database"]["name"] = "***";
$options["database"]["username"] = "****";
$options["database"]["password"] = "***";
$options["database"]["table"] = "tmc";
// -- noAutoQuery (for custom queries)
$options["database"]["noAutoQuery"] = true;
// -- fetchEmptyRow (for custom defaults)
$options["database"]["fetchEmptyRow"] = true; //отключить автозаполнение если не выполняется sql условие
$options["formatting"]["kol"] = "currency[suffix=шт]";
$options["formatting"]["num"] = "currency[prefix=№ ,thousands=]";
// -- Добавление суммы
$options["totals"] = array("kol");
$options["pagination"]["perPage"] = 30; // 10 rows per page.
$options["pagination"]["prev"] = "prev"; // "prev" link will be shown.
$options["pagination"]["next"] = "next"; // "next" link will be shown.
// $options["pagination"]["linkCount"] = 2; // 2 links on each side of the current page.
//---------------------------------
//$doc_id = $_GET['docid']; //айди документа
//print_r ("id-".$doc_id);
//------список выпадающий---------------
$doc_parent = $modx->getParent($doc_id,1,'id'); //получаем id родителя документа
$tmc_parent = $modx->getAllChildren($doc_parent[id],'menuindex','ASC','id,pagetitle'); //получаем массив параметров документа
//переводим массив в одномерный
foreach ($tmc_parent as $item) {
$_tmc_parent[$item['pagetitle']] = $item['id']; };
//print_r ($_tmc_tip);
$options["selects"] = array("parent" => $_tmc_parent ); //создаем выпадающие списки из наших массивов
//--------------------------------------------
$options["showAddNewRow"] = true; //добавить новую строку
$options["defaultFields"] = array("kol" => "1","parent" => $doc_id); // значения по умолчанию
$options["columns"] = array("kol" => "kol","parent" => "parent");
$options["headers"]["parent"]= "За кем закреплено";
$options["headers"]["tip"]= "Тип";
$options["headers"]["name"]= "Название";
$options["headers"]["num"]= "Инв./номенкл. №";
$options["headers"]["kol"]= "Кол.";
// Instanciates the table. This must be included here!
$table = new TableGear($options);
// If you need to use a custom query instead of the default (fetching everything), you can specify it here.
// You can use any syntax in the query you want, however you MUST include the primary key field in the SELECT
// clause, otherwise none of the editing functionality will work! Also, if you need pagination on the table
// you MUST include "SQL_CALC_FOUND_ROWS" after the SELECT clause and not have any LIMIT or ORDER BY clauses!
//
$doc_where = 'WHERE parent='.$doc_id;
if ($doc_id == '') {$doc_where = '';}
$table->fetchData("SELECT SQL_CALC_FOUND_ROWS id,parent,tip,name,num,kol FROM tmc ".$doc_where );
$table->getTable();
$table->getJavascript("jquery");
?>
<script type="text/javascript" src="/assets/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/assets/modules/tablegear/javascripts/tablegear-jquery.js"></script>
<link type="text/css" rel="stylesheet" href="/assets/modules/tablegear/stylesheets/tablegear.css" />
[!TableGear? &doc_id=`[*id*]`!]
CREATE TABLE IF NOT EXISTS `tmc` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parent` varchar(255) NOT NULL,
`tip` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`num` varchar(255) NOT NULL,
`kol` int(6) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=14 ;
Комментарии (2)
RSS свернуть / развернутьПлагин очень хороший) Спасибо!
sazanof
fortunato
Только зарегистрированные и авторизованные пользователи могут оставлять комментарии.