LSPS documentation logo
LSPS Documentation
Icon in a forms::Grid

Required result: A Grid Column displays an icon in the given row.

grid_with_icon_result.png
  1. Create a GO-BPMN project with a module and a forms definition.
    grid_with_icon_project.png
  2. In the forms definition, insert a Grid and define its data source, for example, collection {1..10}.
  3. Insert a Grid Column into the Grid, which will hold an icon.
  4. On the column, set type of the value provider to Closure and define its value as a closure that returns the icon, for example:
    { i:Integer ->
      new FontAwesome5("ambulance").toHtml();
    }
  5. Set the renderer to HTML.

You can modify the closure so the icon changes depending on circumstances:

//i is the row object: we set the data source to a collection
//of Integers; therefore, it is an Integer:
{ i:Integer ->
  def FontAwesome5 icon;
  if i%2==0 then
    icon := new FontAwesome5("sticky-note");
  else
    icon := new FontAwesome5("ambulance");
  end;
  icon.toHtml();
}
grid_with_icon_form.png