Jointjs: Embed Parents and Children

Asked

Viewed 57 times

4

Good,

I’m working with Jointjs but in a dynamic way.

I am currently trying to embed the 'Parent' and 'Child' elements'.

After selecting with the Child and Parent info, I get to get this information: QUERY

<?php public function getElemLinks($param)
{
    $this->cleanErrors();
    $this->sql->cleanErrors();

    $query="SELECT
                linkEl.ID,
                linkEl.id_arquitectura,
                linkEl.nome_link,
                linkEl.source_box,
                linkEl.target_box,
                linkEl.link_texto,
                linkEl.link_textPos,
                linkEl.link_strokeCor,
                linkEl.link_strokeWidth,
                linkEl.link_router
            FROM
                arquitecturas_link_elementos as linkEl          
            WHERE
                linkEl.id_arquitectura = '".$param['arquitectura']."'
            ";

    $this->sql->query($query);

    //echo $query;

    if($this->sql->hasErrors()){
        $this->errors = $this->errors + $this->sql->errors;
        return false;
    }

    while($row = $this->sql->fetchRow())
    {
        $res[] = $row;
    }

    if($this->sql->hasErrors()){
        $this->errors = $this->errors + $this->sql->errors;
        return false;
    }

    return $res;
} ?>

GET - JSON

$.getJSON( "controller/diagramas.php", {
    arquitectura: servicoUtilizado,
}, function(infoElementos){ 
    $.each(infoElementos["parents"], function(prindex, objp){
        //Embed boxes 'filhos' nas áreas 'pai'
        console.log(object.caixas[objp.parentNome].embed(object.caixas[objp.nome_caixa]));
    });


});

What happens is that when implementing this code, the Child elements get stuck and cannot drag and once I move the Parent element the Child elements do not accompany it, as supposed.

  • Solved your problem?

  • Not yet. I’ve tried several options but it didn’t solve what I wanted

  • Can print an error?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.