Problem with second loading of a DataView with Paging


#1

I have been experimenting with DHTMLX for a few weeks and think I have a reasonable grasp on the various methods but have been stuck on this one problem for many hours. Hopefully someone can point out what I am missing.

I have a main form with a DataGrid. When I double-click a row in the DataGrid, it pops up a new window with a “3E” layout. I have a Pager in cell “a”, a DataView in cell “b” and a Close button in cell “c”.

The first time I open this form, all objects work properly. If I close it and then re-open it, it does not load objects in any cell. If I temporarily remove the Pager, I can close and re-open the window as many times as I want and the DataView and Close button work properly.

My code is below. Double-clicking the DataGrid on the Main form calls “pagingTest”. The “alerts” are for testing. On the second time opening the form, it does not alert at “step 2”.

[code]function pagingTest(){
dhxWins = new dhtmlXWindows();
dhxWins.attachViewportTo(document.body);
myWindow = dhxWins.createWindow(“myWindow”, 0, 0, 500, 500);

myLayout = new dhtmlXLayoutObject({
	parent: myWindow,
	pattern:"3E",
	cells: [
		{id:"a", height:50, header:false, fix_size:[null, true]},
		{id:"b", text:"Panel 1", width:500, header:false, fix_size:[true, null]},
		{id:"c", height:50, header:false, fix_size:[null, true]}
	]
});

alert(“Step 1”);

myDataView = myLayout.cells("b").attachDataView({
	type:{
		template:"#invIndex#<br/>#column01#",
		height:100,
	},
	pager:{
		container:"pagingContainer",
		size:16
	}
});

alert(“Step 2”);

//disable the next line and DataView always loads
myPaging = myLayout.cells(“a”).attachObject(“pagingContainer”);

myDataView.load("getData.php");

formCloseData = [
		{type:"button", name:"bttnClose", value:"Close"}
	];
formClose = myLayout.cells("c").attachForm(formCloseData);
formClose.attachEvent("onButtonClick", fnClose);

}

function fnClose(){
if (dhxWins != null && dhxWins.unload != null) {
dhxWins.unload();
dhxWins = myWindow = myLayout = myPaging = myDataView = null;
}
}[/code]

//This is my DIV for the paging container

[code]

[/code]

//This is getData.php

[code]<?php
include("…/config.php");
require_once("…/codebase/connector/dataview_connector.php");
require_once("…/codebase/connector/db_mysqli.php");

$conn = mysqli_connect($host, $user, $pass, $db);

$data = new DataViewConnector($conn, "MySQLi");
$data->enable_log("testConn.txt");
$data->render_sql("SELECT * FROM tblInventory", "invIndex", "invIndex, column01");

?>
[/code]

//These errors show up in my testConn.txt file
Undefined variable: start at C:\wamp\www\catCreator\codebase\connector\dataview_connector.php line 68
Undefined property: DataViewConnector::$extra_output at C:\wamp\www\catCreator\codebase\connector\base_connector.php line 714

line 68: $start.= “>”;
line 714: return $this->extra_output."";

I don’t know how or even if those errors in the testConn.txt file relate to the problem but I’m including them in case someone can make more sense of them than I can.

I’ve tried all sorts of variations of closing, detatching and destructing the Pager and other objects but I haven’t had any luck.

Thanks in advance.


#2

Hello
Could you provide us completed demo on support@dhtmlx.com with a link to this topic?
docs.dhtmlx.com/auxiliary_docs__ … pport.html


#3

I’m currently running under a WampServer environment for testing and don’t have anything online yet. However, as I intend to purchase a commercial license if I can do everything I need to with DHTMLX, I really need to put something online as a final test. I should get a chance to do that in the next couple of days and will reply again with a link where you can see the problem in action.


#4

Anyway you can attach offline demo, just to be opened “under” any server


#5

Darya,

I sent a demo with links to support@dhtmlx.com as per your instructions a couple of days ago but haven’t seen an update on the topic. Since then, I have simplified the demo. Previously, it was drawing data from a MySQL database but I’ve replaced it with a version which draws from your own xml.php file.
It still has the exact same problem though - I can’t open the window with the DataView and Paging objects a second time.


#6

Demo files attached: (index.html, xml.php)
gridDemo.zip (3.12 KB)


#7

Oops, I misread your demo requirements and missed that I had to put xml.php in the /data folder. I’ve updated the index file to point to the correct folder.
gridDemo.zip (3.13 KB)


#8

You need to try to hide() and show() window and attach new content every time. You don’t need unload window every time you close it.


#9

Doh!
I hadn’t even considered that option. Thanks for your help. It works.
So far, I am very impressed with your product.


#10

You are welcome!
Thank you for using!