Knowledge Base

Search documentation by Keyword

3.1.02 Start a grid

When starting a grid with the first request a parameter to get the column information with the headers, type, width is send to the iAPI. According to the endpoint, the following will be send:

  • urlendpoint/grid: this will be used if the grid must start and there are no parameters to filter on.
  • urlendpoint?key=xxx&headers=1: if there are parameters to search or filter on, BOA will add &headers=1 as extra parameter to the endpoint.

In both cases BOA expects the header information in the response. With this header information the grid can be build. BOA will ask only in the first request for the headers, this to optimize speed and bandwidth. It is no problem to send the headers array with each request if it is difficult to check for the /grid or &headers=1 parameters.

Response

In the response you need to send the header information, if requested, and the data information. Both are an array with json objects.

Headers

The headers defines the structure of the grid. This is a sample for a list of country codes:

{
“file”: “countrycodes”,
“headers”: [
{
“title”: “Country code:”,
“data”: “code”,
“width”: “15%”,
“type”: “text”,
“total”: “”,
“edit”: false
},
{
“title”: “Country:”,
“data”: “land”,
“width”: “50%”,
“type”: “text”,
“total”: “”,
“edit”: true
},
{
“title”: “Tax code:”,
“data”: “landcode”,
“width”: “15%”,
“type”: “text”,
“total”: “”,
“edit”: false
}
]
}

  • file: table name of the data. This is informative and not used by BOA.
  • serverload: true or false. If serverload is set to true, BOA will send a request for the next block. It will use the first of last ID to send the request. This way a large dataresult can be split and loaded in parts. Default is false.
  • headers: array with the header objects.

The header object has the following data:

  • title: header title, is shown in the header of the grid.
  • data: fieldname of the data to shown. This fieldname must exist in the data objects.
  • width: width of the column in %. The total of all the columns has to be 100 or less.
  • type: type of the data. The following is possible:
    • text: alphanumeric field
    • int: numeric without decimals.
    • float: numeric with decimals
    • bool: logical checkbox
    • date: date field
  • total: if the column must be totalised you need to enter sum. Other options will be added to BOA in the future.
  • edit: false or true. If the edit is true, you have cell-edit in the grid. After each edit BOA will send the data as a PUT to update.
This is the grid which is made with the above header data.

Data

In the response there is also the data array if there was a search key in the request. The data section is an array of json objects with the following info:

“data”: [
{
“id”: “20”,
“code”: “A “,
“land”: “BBBBB13 “,
“landcode”: “C “,
},
{
“id”: “23”,
“code”: “A0 “,
“land”: “test a1925 “,
“landcode”: “A “,
},
{
“id”: “24”,
“code”: “A1 “,
“land”: “test a1 “,
“landcode”: ” “,
},
{
“id”: “25”,
“code”: “A2 “,
“land”: “test A2 “,
“landcode”: ” “,
}]

  • data: array with the data.
  • id: a data elements needs to have an unique id. Without id BOA cannot work!
  • code: fieldname which is also defined in the headers section. Same for land and landcode.

For each column of the grid, an entry must be available in the data array.

The array can also have extra data, that is not shown in the grid. This can be used when you search for data and there is hidden information that you need to use after selection. There will be samples of this in the forms, eg zip codes.