These are chat archives for hyperoslo/Form

27th
Jun 2017
Elvis Nuñez
@3lvis
Jun 27 2017 05:21
@aminiz Hi! Giving it some thought this could potentially be solved by providing number of columns and height for the options. So this will be a “multiselect” field that covers 100% of the width. In iPhone the number of columns would be forced to 1 but on iPad it could be used to represent the width of each option. Here each option would contain a multiline UILabel, if you expand the height of the option then UIKit would make sure to show the text in two lines, this gives us a nice and uniform grid. We could also go the Pinterest approach and make each option have it’s own sizing.
{
  "id": "skill_types",
  "title": "Has the patient had or presently have any of the following conditions?",
  "type": "multiselect",
  "min_selected_values": 1,
  "max_selected_values": 3,
  “number_of_columns”: 2,
  “row_height”: 1,
  "values": [
    {
      "id": 0,
      "title": "Hearth Attack"
    },
    {
      "id": 1,
      "title": "Stroke"
    },
    {
      "id": 2,
      "title": "Ulcer"
    },
    {
      "id": 3,
      "title": "Chest pains"
    },
    {
      "id": 4,
      "title": "Hypertension"
    }
  ]
}
Elvis Nuñez
@3lvis
Jun 27 2017 05:51
2.jpg
In the first example we use 3 columns and height 1, in the second example 3 columns and height 3 and in the third example we use 2 columns and height 1.
It works fine if you know the data that you're getting.
The other suggestion is to use a pinterest/waterfall style layout where we would balance the options to fill each column as much as possible.
2.png
Here we could drop specifying the amount of columns and the height since it's dynamic.
Sadaqat
@aminiz
Jun 27 2017 19:03
@3lvis I like the uniform look. Pinterest/waterfall style doesn't seem like it fits into the form look and feel.
As you mentioned, specifying row_height will work if we know the data we're getting. But perhaps the data may not be known initially. What if we let the library choose the height? We could default number_of_columns to 1 but allow the user to override it.