m (→Filtering) |
(→XML Attributes Description) |
||
Line 110: | Line 110: | ||
Can be | Can be | ||
* hardcoded - the name of xml file | * hardcoded - the name of xml file | ||
− | | | + | |- |
+ | | title="Attribute" | <code>gn:disablePreloadActionsDuringListViewResize</code> | ||
+ | | title="Description" | Disables loading beforeLoad and afterLoad actions on row during keyboard opening on list which is <code>gn:lstExpandToFitChildren</code> set to <code>true</code>. This avoids heavy load on lists with checkboxes but decreases performance on list with dropdowns. | ||
==Example== | ==Example== |
Revision as of 15:39, 17 July 2018
GnListView
- Widget XML tag
-
<com.ginstr.widgets.GnListView>
- Description
-
GnListView
is used to show data in a table appearance, with header on the top and data in rows with cells below.
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
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
gn:data_columns_name{n}
|
Defines the names from left to right that will appear in header columns
Can be
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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 ( Can be
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
gn:data_columns_id{n}
|
Defines column identifiers
If the data is loading from database that has columns i.e. Can be
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
gn:data_columns_type
|
Defines cell type for each row which will display data
Can be
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
gn:data_filters{n}
|
Defines filter parameter to sort data
Once data is loaded into Filters are separated by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
gn:data_columns_sort{n}
|
Defines column by which data will be sorted
Currently, sorting only accepts ascending sort by columnID defined by value of this attribute. 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: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
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
gn:lstExpandToFitChildren
|
Stretches GnListView to load all children without scroll
Used only if listView is If set to Can be
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
gn:complex_cell_layout
|
to create complex list layouts based on one cell in row
Can be
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
gn:custom_xml
|
customised XML listview layout
Can be
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
gn:custom_header_xml
|
customised XML listview header layout
Can be
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
gn:custom_row_xml
|
customised XML row layout
Can be
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
Example<com.ginstr.widgets.GnListView android:id="@+id/lstResidents" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_horizontal" android:background="#e1e1e1" gn:data_columns_name="resident_nfcTagUid,resident_firstName,resident_lastName,resident_roomNo,resident_buildingCode" gn:data_columns_id="resident_nfcTagUid,resident_firstName,resident_lastName,resident_roomNo,resident_buildingCode" gn:data_columns_type="text,text,text,text,text" gn:serverTableGenerator="ignore" gn:lstRefreshNoFilter="true" gn:s_listSelector="#00000000" gn:custom_xml="customList_listview.xml" gn:custom_header_xml="residentsList_header.xml" gn:custom_row_xml="residentsList_row.xml" gn:complex_cell_layout="true" /> Filtering
|
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
- 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
Filters
Filter Description [VALUE]
- 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 returntrue
and data row loaded intoGnListView
.
[WIDGET]
- 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 tocolumnA
of listview datarow. Iftrue
row will be shown.
[KEYWORD]
-
[KEYWORD]
filter compares values from list with special values that cannot be obtained by other means. -
[#KEYWORD]|[COMPARATOR]|[COLUMNID]
- Keyword
#today
checks if value from listview is within today's date. If it is then it returnstrue
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.
- Compares a value against value loaded into
pointer additional XML attributes
Attribute | Description |
---|---|
gn:data_source_request
|
id of query which will be used to get pointed value
|
gn:data_source_table
|
name of table which will get queried
|
gn:data_source_field
|
column of referenced table which we would like to display supported referencing columns of data type text
|
gn:data_source_keys
|
optional
query keys in case referenced table values need to be reduced. This optimises memory on large table loads.
|
Alternative layout
Alternative layout can be set into control folder.
Special widget which has multiple XML files defining multiple parts of this composite widget:
widget_en_listview_row_container.xml
- defines how listview container appearance will look
widget_en_listview_header_container.xml
- defines how header container appearance will look
widget_en_listview_column_string.xml
- defines how column cell of type string will look
id Type @+id/tvDisplayView
TextView
widget_en_listview_column_pointer.xml
- defines how column cell of type pointer will look
id Type @+id/tvDisplayView
TextView
widget_en_listview.xml
- defines the appearance of the listview container
id Type @+id/lstHeader
FrameLayout
@+id/lstListView
ListView