contributte / datagrid

:muscle: DataGrid for Nette Framework: filtering, sorting, pagination, tree view, table view, translator, etc
https://contributte.org/packages/contributte/datagrid/
MIT License
290 stars 194 forks source link

Tree-view doctrine data source + sorting #489

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hi, I am begginer in nette, so that can be reason why I can't find out solution for my problem. I am using doctrine and I woud like to have tree-view for groups in my system. You got example for dibi source, but I can't "translate" it to dql. I hope you can help me. No idea how to do it. I don't know if I shoud write only column parent_id or make join. My entity looks like this. Thanks for any help.


/**
 * @ORM\Entity
 * @ORM\Table(name="groups")
 */
class Group
{
    use Entities\MagicAccessors;
    use Entities\Attributes\Identifier;
    /**
     * @ORM\ManyToOne(targetEntity="Site", inversedBy="groups")
     * @ORM\JoinColumn(name="site_id", referencedColumnName="id")
     */
    private $site;
    /**
     * @ORM\ManyToOne(targetEntity="Group")
     * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", nullable=true)
     */
    protected $parent;
    /**
     * @ORM\Column(type="string", length=32, nullable=false)
     */
    protected $name;
    /**
     * @ORM\Column(type="string", length=32, nullable=false)
     */
    protected $ename;
}
ghost commented 7 years ago

I made some progress, but still can't fix everything. I can now see tree-view and sort, but can't add children to item. Can you add working example of handleSort for tree-view to documentation? If I set children in db, it shows itself correctly, but it can't be moved.

ghost commented 7 years ago

huh, nevermined some bug in matrix i guess...another pc works fine