Grid webix with url column click

just created a table in webix, I have a “TBD” column where I display a URL, my question is: how to make this URL https://pops.dra.com/TBD.php?jour=$adep&arc=$ads clickable please?

while($row = mysqli_fetch_array($requete, MYSQLI_ASSOC)) {

        $row_array['ac'] = $row["TA"];
        $row_array['ad'] = $row["day"];
        $ad = $row["day"];
        $row_array['ads'] = $row["arc"];
        $ads = $row["arc"];
        $row_array['eob'] = $row["pl"];
        $row_array['linkjournal'] = "https://pops.dra.com/TBD.php?jour=$adep&arc=$ads";

        array_push($small_film_set2, $row_array);

    }

    }
    $date_update = $small_film_set2[1]['adep'];

?>

        var small_film_set2 = <?php echo json_encode($small_film_set2) ?>;
        webix.ready(function(){
            grid = webix.ui({
                container:"testA",
                view:"datatable",
                columns:[
                    { id:"index",   header:"TA", sort:"int"},
                    { id:"ac",  header:["CT", {content:"selectFilter"}],width:120,  sort:"string"},
                    { id:"ad",  header:["Date",  {content:"textFilter"}] , width:120,   sort:"int"},
                    { id:"ads", header:["Arcid", {content:"textFilter"}],   width:100,  sort:"string"},
                    { id:"eob", header:["Pl", {content:"textFilter"}],  width:100,  sort:"string"},
                    { id:"linkjournal", header:["TBD"],     width:220,  sort:"string"}
                    //{ id:"ssr",   header:"Nb",    width:100,  sort:"int", header:[ "nb", {content:"summColumn" }] }
                ],
                autoheight:true,
                autowidth:true,
                data:small_film_set2,
                on:{
                    "data->onStoreUpdated":function(){
                        this.data.each(function(obj, i){
                            obj.index = i+1;
                        })
                    }
                }
            });
        });

Thanks for your help

Answer

Define a column template, there you can add html elements, e.g.:

{ 
    id:"linkjournal", header:["TBD"],     
    width:220,  sort:"string",
    template: obj => `<a href="${obj.linkjournal}">link text</a>`
}

Leave a Reply

Your email address will not be published. Required fields are marked *