# Is it possible to generate widgets based on an other widget ? JSServe

**URL:** https://discourse.julialang.org/t/is-it-possible-to-generate-widgets-based-on-an-other-widget-jsserve/99591
**Category:** New to Julia
**Tags:** dashboard, interactivity, jsserve
**Created:** [May 30, 2023, 8:37am UTC](https://discourse.julialang.org/t/is-it-possible-to-generate-widgets-based-on-an-other-widget-jsserve/99591 "2023-05-30T08:37:51Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Ludovic\_Dumoulin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ludovic_dumoulin/32/22414_2.png) [@Ludovic\_Dumoulin](https://discourse.julialang.org/u/Ludovic_Dumoulin)
#### Post date: [May 30, 2023, 8:37am UTC](https://discourse.julialang.org/t/is-it-possible-to-generate-widgets-based-on-an-other-widget-jsserve/99591/1 "2023-05-30T08:37:51Z")

</div>

Hello,

I am still new to Julia and use it mainly for physics simulations.

I am generating a dahboard from a csv file. The idea is to explore the csv file using widgets (to get the value of the last collumn at a specific row by using widgets to select it). In order to generate the rigth amount of widget I use metaprogramming. Example:

```julia
    for i in 1:Ncol-1
        if length(tab_list[i]) > 1
            if isa((tab_list[i][1]), AbstractString)
                symbolname = Symbol("sl_$(var_list[i])")
                @eval $symbolname = $(D.Dropdown("$(var_list[i])", tab_list[i]) ) 
                @eval push!(sl_list, $symbolname )
                push!(sl_name, "sl_$(var_list[i])")
            else
                symbolname = Symbol("sl_$(var_list[i])")
                @eval $symbolname = $(D.Slider("$(var_list[i])", tab_list[i]))
                @eval push!(sl_list, $symbolname )
                push!(sl_name, "sl_$(var_list[i])")
            end
            symbolname = Symbol("check_$(var_list[i])")
            @eval $symbolname = $(D.Checkbox("", false))
            @eval push!(check_list, $symbolname)
            push!(check_name, "check_$(var_list[i])")
            push!(var_list_sl, "$(var_list[i])")
            global N_wid += 1
        end
    end
    for wid in 1:N_wid
        eval(quote
                on($(check_list[wid]).widget.value) do x
                    dist = zeros(Nrow)
                    for r=1:Nrow
                        for c=1:N_wid
                            dist[r] += Int(df[r, Symbol(var_list_sl[c])] == sl_list[c].widget.value[])*(1 + Int(check_list[c].widget.value[])*100)
                        end
                    end
                    idx = findmax(dist)[2]
                    for c=1:N_wid
                        if sl_list[c].widget.value[] != df[idx, Symbol(var_list_sl[c])]
                            if !isa(sl_list[c].widget.value[], AbstractString)
                                sl_list[c].widget[] = df[idx, Symbol(var_list_sl[c])]
                            else
                                sl_list[c].widget.value[] = df[idx, Symbol(var_list_sl[c])]
                            end
                        end
                    end
                    global fn[] = string(df[idx,:fn])*"/"
                end
            end)
    end

```

But I need to load the csv file first to generate the number of widget. I would like to use another widget to select the csv file and then generate the rest of the dashboard (other widgets and etc…).  
I was wondering if it is doable ? and, if it possible, do you have a link toward an example or a reference ?

Thank you for your help,

Best,
