Update TreeGrid with multitable connector

Hello,

I have a problem with updating a TreeGrid using the multitable connector.

This is my serverside code

[code]$res=oci_connect(‘connectstring’); //connects to the server with our DB

    $dbtype = "oracle";
    

    $grid = new \TreeGridMultitableConnector($res, $dbtype);
    $level = $grid->get_level();
    $grid->enable_log('gridlog.txt',true);
    $grid->dynamic_loading(100);
    $grid->setMaxLevel(1);
    $level = $grid->get_level();
    \LogMaster::log("level: ".$level);
          switch ($level) {
        case 0:
            $grid->render_table("ikd_kal_wartung_block","kwb_nid","kwb_vbezeichnung,kwb_vbeschreibung,NULL","","");
            break;
        case 1:
            $grid->render_table("ikd_kal_wartung_detail","kwd_nid","kwd_vbezeichnung,kwd_vbeschreibung,kwd_vperson","","kwd_nkwb_nid");
            break;
   
     }[/code]

Loading data works, but when I try to update using dataprocessor, get_level() returns -1

This is my clientside code:

[code]var treeGrid = new dhtmlXGridObject(“treeGrid”);
treeGrid.setImagePath(“{{ asset(‘dhtmlx/imgs/’) }}”); //the path to images required by grid
treeGrid.setHeader(“Bezeichnung,Beschreibung,Person”); //the headers of columns
treeGrid.setInitWidths(“*,300,100”); //the widths of columns
treeGrid.setColAlign(“left,left,left”); //the alignment of columns
treeGrid.setColTypes(“tree,ed,ed”); //the types of columns
treeGrid.setColSorting(“str,str,str”); //the sorting types

    treeGrid.enableAutoHeight(false);
    //treeGrid.setColumnHidden(3,true);
    treeGrid.enableSmartRendering(true);
    //treeGrid.enableSmartXMLParsing(true);
    //treeGrid.enablePaging(true,15,5,"pagingbox",true,"recInfoArea");
    
    treeGrid.init();					
    treeGrid.kidsXmlFile="{{ path(vendor_plaka_connector_admingrid') }}";
    treeGrid.loadXML("{{ path(vendor_plaka_connector_admingrid') }}");
    treeGrid.setSkin("dhx_skyblue")

    var dp = new dataProcessor("{{ path(_vendorplaka_connector_admingrid') }}");
    dp.init(treeGrid);[/code]

I’m using Symfony 2.6 (“{{ path(_vendorplaka_connector_admingrid’) }}” points to my connector controller).

Philipp Löwen

By any chances, do you have “_” or “,” characters in the row IDs ?
Multitable connector uses “,” as delimiter during id|level serialization, so if you have “,” in the original id value then connector will not be able to work correctly.

The column ids contain a “_” but the row id is a normal oracle NUMBER value.

When I try to update, this is sent to the server:

1%2C4_gr_id=1%2C4&1%2C4_gr_pid=0%2C2&1%2C4_c0=Stormeldetool&1%2C4_c1=Version%203.2&1%2C4_c2=&1%2C4_!nativeeditor_status=updated&ids=1%2C4

After replacing %2C for “,”:

1,4_gr_id=1,4&1,4_gr_pid=0,2&1,4_c0=Stormeldetool&1,4_c1=Version%203.2&1,4_c2=&1,4_!nativeeditor_status=updated&ids=1,4

That should mean level 1 and id 4, shouldn’t it?

When I add render_table for level=-1, the serverside log shows the following:

[code]level: -1

DataProcessor object initialized
1,4_gr_id => 1,4
1,4_gr_pid => 0,2
1,4_c0 => Stormeldetool
1,4_c1 => Version 3.2
1,4_c2 =>
1,4_!nativeeditor_status => updated
ids => 1,4[/code]

I have no idea what’s wrong here.

Philipp Löwen

Please try to update connector/strategy.php with the attached one.
strategy.zip (2.85 KB)

It works now!
Thank you very much.

Philipp Löwen