Creating a grid with the Builder
Sometime, we'd like to create a UI component with the Builder code rather than pre-marking it up in the ZUL file. Here's the example of creating a `grid`. Suppose we have: We can write the above code using the Builder as: grid { columns { column(label: "Id") column(label: "Name") } rows { row { label(value:"1") label(value:"Korat") } row { label(value:"2") label(value:"Bangkok") } } } A step further, if we have a map containing the data, we can use the `each` closure to dynamically create the similar grid. def data = [1: "Korat", 2:"Bangkok"] grid { columns { column(label: "Id") column(label: "Name") } rows { data.each { k, v -> row { label(value: "$k") label(value: "$v") } } } }








