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]
//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.