Jump to: navigation, search


Widget XML tag
GnListView is used to show data in a table appearance, with header on the top and data in rows with cells below.
Column _id is a special column which represents unique rows. In case this column exists, the value in each row must be unique or not defined.

XML Attributes Description

Attribute Description
gn:data_columns_width{n} Defines the width of each column from left to right that appears in listview

Can be

  • hardcoded, i.e. 50,50,50
gn:data_columns_name{n} Defines the names from left to right that will appear in header columns

Can be

  • hardcoded, i.e. resident_nfcTagUid,resident_firstName
  • @string
gn:data_columns_settings{n} Defines the settings for each column from left to right that is displayed in listview.

If there is a single column to be shown in listview there is no separator between settings for columns.

If there are 2 or more columns whose settings should be configured, a “pipe” character (|) is used to separate them i.e. “settingsColumn1|settingsColumn2|…”.

Can be

  • format – converting long to human readable date and time, correct formats here
gn:data_columns_id{n} Defines column identifiers

If the data is loading from database that has columns i.e. name, surname, to read that data to listview your columns should have same id’s surname, name. Note that the order here is not important.

Can be

  • hardcoded, i.e. resident_nfcTagUid,resident_firstName
  • @string
gn:data_columns_type Defines cell type for each row which will display data

Can be

  • text
  • pictures
  • pointer - must be used in combination with additional pointer attributes. More about attributes here
  • dateTime
  • phoneNumber
gn:data_filters{n} Defines filter parameter to sort data

Once data is loaded into GnListView, it can be filtered by defining filter parameter.

Filters are separated by , (comma symbol) and they have special syntax. More about filters here.

gn:data_columns_sort Defines column by which data will be sorted

For example if dbRequest has columns: name,surname,timestamp, and name is set as a value for this attribute then all rows will be sorted ascending by name.

gn:sortOrder represents sorting order

Can be

  • hardcoded
    • regular - default
    • reverse
gn:lstRefreshNoFilter Defines that on refresh data will not be filtered (used only in special cases when business logic implementation is used)

This attribute is not relevant to designer and if developing a standard ginstr app then it can be omitted.

Can be

  • true
  • false
gn:lstExpandToFitChildren Stretches GnListView to load all children without scroll

Used only if listView is com.ginstr.widgets.internal.ExpandableHeightListView in control/widget_en_listview.xml.

If set to true, GnListView will stretch to load all children without scroll.

Can be

  • true
  • false
gn:complex_cell_layout to create complex list layouts based on one cell in row

Can be

  • true
  • false
gn:custom_xml customised XML listview layout

Can be

  • hardcoded - the name of xml file
gn:custom_header_xml customised XML listview header layout

Can be

  • hardcoded - the name of xml file
gn:custom_row_xml customised XML row layout

Can be

  • hardcoded - the name of xml file
gn:custom_row_xml_odd(M103.8.0.5) customised XML row layout for odd rows. If not defined, gn:custom_row_xml will be used instead.

Can be

  • hardcoded - the name of xml file
gn:custom_row_xml_even(M103.8.0.5) customised XML row layout for even rows. If not defined, gn:custom_row_xml will be used instead

Can be

  • hardcoded - the name of xml file
gn:disablePreloadActionsDuringListViewResize Disables loading beforeLoad and afterLoad actions on row during keyboard opening on list which is gn:lstExpandToFitChildren set to true. This avoids heavy load on lists with checkboxes but decreases performance on list with dropdowns.
gn:s_listSelector is used to highlight the currently selected item

Can be

  • hardcoded - e.g. "#00FF00"



Data types



  gn:complex_cell_layout="true" />


Once data is loaded from the database it can be filtered by a filter mechanism. You can also filter the data loaded into the GnListView by using the following filter types:
Filters can also be chained by chain words:
  • AND
  • OR
If the filters are chained then each of filter statements must be true in order to show some record that is in GnListView data.
The upper statement filters the GnListView in the following way:
IF the widget that has id “@+id/widgetOne” has a value equal to the value in columnOne in listview rows AND if timestamp value in listview rows is within today AND if columnAnimalType value in listview rows is equal to “dog”, then the row from listview rows will be displayed in GnListView.
Based the example above, the filter chaining definition is:
General filter [FILTER] definition is:
Filters behave differently depending on the content of the [VALUE] field.

[VALUE] field special characters

Special Character Description
:: Defines range in VALUE (turns filter into RANGE filter) (not yet implemented)
* Equivalent to like
# Keyword identifier (turns filter into KEYWORD filter)
@+id/ Widget id
\ Escape character
In order to use special characters as standard text you need to escape them as follows: \::, \*, \#, \@+id/ or \\


Comparators define the relation between the two values that are being compared.
The following comparators can be used to compare:
Comparator Symbol Description Value Types Allowed
= Equals to values STRING, NUMBER
c= Case sensitive equals to values STRING, NUMBER
> Greater than value NUMBER


Filter Description
Compares a value against value loaded into GnListView data rows.
The definition of value filter is as follows:
[VALUE]|[COMPARATOR]|[COLUMNID]:i.e. [two]|[=]|[columnOne]
The following filter will compare data row value if is equal to two, filter will return true and data row loaded into GnListView.
If [VALUE] field contains special character @+id/ filter will behave as Widget filter.
[WIDGET] filter compares listview datarow value with value of a certain widget.
[@+id/WIDGET_ID]|[COMPARATOR]|[COLUMNID]:i.e. [@+id/widgetOne]|[=]|[columnA]
This filter checks if a widget with id @+id/widgetOne has value equal to columnA of listview datarow. If true row will be shown.
[KEYWORD] filter compares values from list with special values that cannot be obtained by other means.
Keyword #today checks if value from listview is within today's date. If it is then it returns true and row is displayed.
i.e. [#today]|[=]|[timestamp] is timestamp field within today's date
When using the timestamp the dateTime datatype must be used.

pointer additional XML attributes

Attribute Description
gn:data_source_request id of query which will be used to get pointed value
Can be
  • hardcoded
gn:data_source_table name of table which will get queried
Can be
  • hardcoded
gn:data_source_field column of referenced table which we would like to display supported referencing columns of data type text
Can be
  • hardcoded

query keys in case referenced table values need to be reduced. This optimises memory on large table loads.

Can be
  • hardcoded

Alternative layout

Alternative layout can be set into control folder.

Special widget which has multiple XML files defining multiple parts of this composite widget:


defines how listview container appearance will look


defines how header container appearance will look


defines how column cell of type string will look
id Type
@+id/tvDisplayView TextView


defines how column cell of type pointer will look
id Type
@+id/tvDisplayView TextView


defines the appearance of the listview container
id Type
@+id/lstHeader FrameLayout
@+id/lstListView ListView