phpMyDatagrid, problem s AJAXem

Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
taypan
Člen | 11
+
0
-

Dobrý den,
snažím se zprovoznit phpMyDatagrid (http://www.gurusistemas.com/…datagrid.php).
Momentálně mám tento presenter:

<?php
class KomponentsPresenter extends BasePresenter
{
	var $objGrid;

	public function getModel()
	{
		return new KomponentsModel;
	}

	public function actionDefault($ident) {

		$objGrid = new datagrid('phpmydatagrid.class.php','1');
		$objGrid -> friendlyHTML();
		$objGrid -> pathtoimages("../css/datagrid/images/");
		$objGrid -> closeTags(true);
		$objGrid -> form('komponents', true);
		$objGrid -> methodForm("get");
		$objGrid -> total("cena");
		$objGrid -> searchby("id,druh,jmeno,cena");
		//$objGrid -> linkparam("sess=".$_REQUEST["sess"]."&username=".$_REQUEST["username"]);
		$objGrid -> decimalDigits(2);
		$objGrid -> decimalPoint(",");
		$objGrid -> conectadb("localhost", "user", "pass", "db");
		$objGrid -> tabla ("komponenty");
		$objGrid -> buttons(true,true,true,true);
		$objGrid -> keyfield("id");
		$objGrid -> salt("salt");
		$objGrid -> TituloGrid("phpMyDataGrid Sample page");
		$objGrid -> datarows(5);
		$objGrid -> paginationmode('links');
		$objGrid -> orderby("id", "DESC");
		$objGrid -> noorderarrows();
		$objGrid -> FormatColumn("id", "ID", 5, 5, 1, "50", "center", "integer");
		$objGrid -> FormatColumn("jmeno", "Name", 30, 30, 0, "150", "left");
		$objGrid -> FormatColumn("cena", "Cena", 5, 5, 0, "50", "right");
		$objGrid -> FormatColumn("druh", "Status", 5, 5, 0, "60", "left",
 		"select:1_cpu:2_gpu:3_hdd");
		$objGrid -> setHeader();
		$this->objGrid = $objGrid;
	}



	public function renderDefault($ident)
	{
		$this->template->grid = $this->objGrid;
	}


}
?>

a šablonu:

{block content}

	<h3></h3>
	<div id="nahledCont">
	{$grid->ajax("silent")}
	 {$grid->grid()}
	 {$grid->desconectar()}

</div>

což vzniklo podle funkčního příkladu:

<?php /*
Copyright (c) 2007-2008, Gur� Sistemas and/or Gustavo Adolfo Arcila Trujillo
All rights reserved.
www.gurusistemas.com

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the distribution.
* Neither the name of the Gur� Sistemas Intl nor Gustavo Adolfo Arcila Trujillo nor the names of its contributors may be used t
endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  "AS IS"  AND ANY EXPRESS  OR  IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,  INDIRECT,  INCIDENTAL, SPECIAL, EXEMPLARY,  OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF  USE, DATA, OR PROFITS;  OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

phpMyDataGrid 2007 is Free, but if you want to get even more power consider upgrade to PRO, contact us and get a special discount.

Please remember donating to phpMyDataGrid Free is one way to show your support, copy and paste in your internet browser the following link to make your donation
https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=tavoarcila%40gmail%2ecom&item_name=phpMyDataGrid%202007&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8

For more info, samples, tips, screenshots, help, contact, forum, please visit phpMyDataGrid site
http://www.gurusistemas.com/indexdatagrid.php

To get more info about the professional version, visit: http://www.gurusistemas.com/

*/ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>phpMyDatagrid - Sample file</title>

<?php

include ("phpmydatagrid.class.php");
$objGrid -> friendlyHTML();
$objGrid -> pathtoimages("./images/");
$objGrid -> closeTags(true);
$objGrid -> form('employee', true);
$objGrid -> methodForm("get");
$objGrid -> total("cena");
$objGrid -> searchby("id,druh,jmeno,cena");
$objGrid -> linkparam("sess=".$_REQUEST["sess"]."&username=".$_REQUEST["username"]);
$objGrid -> decimalDigits(2);
$objGrid -> decimalPoint(",");
$objGrid -> conectadb("localhost", "user", "pass", "db");
$objGrid -> tabla ("komponenty");
$objGrid -> buttons(true,true,true,true);
$objGrid -> keyfield("id");
$objGrid -> salt("salt");
$objGrid -> TituloGrid("phpMyDataGrid Sample page");
$objGrid -> datarows(10);
$objGrid -> paginationmode('links');
$objGrid -> orderby("id", "ASC");
$objGrid -> noorderarrows();
$objGrid -> FormatColumn("id", "ID", 5, 5, 1, "50", "center", "integer");
$objGrid -> FormatColumn("jmeno", "Name", 30, 30, 0, "150", "left");
$objGrid -> FormatColumn("cena", "Cena", 5, 5, 0, "50", "right");
$objGrid -> FormatColumn("druh", "Status", 5, 5, 0, "60", "left", "select:1_cpu:2_gpu:3_hdd");
$objGrid -> setHeader();
?>
</head>

<body>
<?php
$objGrid -> ajax("silent");
$objGrid -> grid();
$objGrid -> desconectar();
?>
</body>
</html>

Příklad funguje bez problémů, editace se projeví v db, atd..
Pokud je ovšem přepsán do presenteru, načte data bez problému, ale při jakékoli akci zůstane vyset na loadingu. Z logu Apache jsem vyčetl, že se AJAX snaží přistupovat na index.php, kde samozřejmě nedostane odpověď.
Jak správně zajistit funkčnost AJAXu?
Popř. nevíte o nějaké komponentě schopné zajistit funkci datagridu s editací (o Editable Datagrid v extras vím, ale developer preview ve mě nebudí moc důvěry).

Předem děkuji za všechny rady.
S pozdravem

Editoval taypan (25. 1. 2011 15:14)