"Undefined offset in treegridmultitable_connector.php"

Hello forum,

as a basis for my experiments, I use the example 07_treegrid_multitable_connector.php from the current dhtmlxConnector_php_v10_110725.zip.
I monitor the background activities $conn->enable_log(“temp.log”,true); and often appear in this file the line “Undefined offset …”. I think some of my problems I have with the connector component are related to. I would like to insert in the treegrid for example a record and get the following entries in the log file:

[code]====================================
Log started, 18/11/2011 02:11:30

Undefined offset: 1 at J:\xampp\htdocs\treegrid\codebase\treegridmultitable_connector.php line 103

Undefined offset: 5 at J:\xampp\htdocs\treegrid\codebase\treegridmultitable_connector.php line 106

DataProcessor object initialized
1321623383101_gr_id => 1321623383101
1321623383101_gr_pid => 2%235
1321623383101_baum => new row
1321623383101_spaltea => text1
1321623383101_!nativeeditor_status => inserted
ids => 1321623383101

Undefined offset: 1 at J:\xampp\htdocs\treegrid\codebase\treegridmultitable_connector.php line 157

Undefined offset: 1 at J:\xampp\htdocs\treegrid\codebase\treegridmultitable_connector.php line 157

Undefined offset: 1 at J:\xampp\htdocs\treegrid\codebase\treegridmultitable_connector.php line 157

Undefined offset: 1 at J:\xampp\htdocs\treegrid\codebase\treegridmultitable_connector.php line 157

Row data [1321623383101]
gr_id => 1321623383101
=> 2%235
baum => new row
spaltea => text1
!nativeeditor_status => inserted

Undefined offset: 5 at J:\xampp\htdocs\treegrid\codebase\treegridmultitable_connector.php line 106

Change id:

change value of: gr_id as:

Change new id:

change value of: as: 5

Incorrect field name used: phone_developer

data
gr_id =>
=> 5
baum => new row
spaltea => text1
!nativeeditor_status => inserted

data
gr_id =>
=> 5
baum => new row
spaltea => text1
!nativeeditor_status => inserted

INSERT INTO phones (phone, phone_type, phone_developer) VALUES (‘new row’, ‘text1’, ‘2’)

Event code for insert processed

Change id: 0%23

Edit operation finished
0 => action:inserted; sid:0%23; tid:0%23154;

Done in 0.007498025894165s[/code]

It is evident that some data are missing. E.g. there is no information on the parent id or the sid as is usual for an update or delete.
My questions are:
[]What does the “Undefined offset” mean?[/]
[]Why is the row still bold after an insert?[/]
[]How can I get the parent id I need for an insert? I have already tried with extra fields but with no success?[/]

I’ve attached my sample files. The behind database I have created from your dump in connector zip.
I would be overjoyed if someone could help me.

Regards
comfortliner
treegrid.zip (2.01 KB)

Hello forum,

has anyone an idea, or a similar constellation that works??

Regards
comfortliner

Hi,
sorry for the delay in answering.

It was a little treegrid reconstruction, but connector naming protocol wasn’t updated.
To prevent this issue occuring please use columns names for grid like here:

mygrid.setColumnIds("c0,c1");

and update treegridmultitable_connector.php from attachment please.

After row inserting incorrect id was returned.

You may use the follow code:

$parent_id = $action->get_value("developer_team");

Where developer_team is parent field name for current connector level.

Some notes about multilevel connector usage:
each level it’s separate connector with it’s own configurations.
So if you like to write custom function for updating row, you have to implement it for one level, not for all levels, because each level has it’s own field names.
So attaching events to connector would be better to implement inside switch ($level) section.
treegridmultitable_connector.zip (1.52 KB)

Hi radyno,
thanks for the reply.

I have updated treegridmultitable_connector.php and it already looks better, but I still have problems with the parentid.
The log after inserting a row includes still one “Undefined offset”.
Also very strange is the following: gr_pid is the parentid which I need for my insert-statement. In the “Post” it is correct (see line 9), but later there is no variable name to catch it (see line 17)?!?

1  ====================================
2  Log started, 06/12/2011 03:12:46
3  ====================================
4
5  Undefined offset: 1 at J:\xampp\htdocs\treegrid\codebase\treegridmultitable_connector.php line 104
6
7  DataProcessor object initialized
8  1323182639285_gr_id => 1323182639285
9  1323182639285_gr_pid => 2%2326
10 1323182639285_baum => new row
11 1323182639285_spaltea => text1
12 1323182639285_!nativeeditor_status => inserted
13 ids => 1323182639285
14
15 Row data [1323182639285]
16 project_id => 1323182639285
17 => 2%2326
18 baum => new row
19 spaltea => text1
20 !nativeeditor_status => inserted

Thanks for the tip. Is that just for the update-statements?

Regards
comfortliner

Hi,
gr_pid is temporary name which should be converted inside dataprocessor into real database field name. If you like to prevent it as gr_pid try to replace in treegridmultitable_connector.php the follow code:

if ($data == "gr_pid") return $this->config->relation_id["name"];

with

if ($data == "gr_pid") return "gr_pid";