From wiki.ginstr.com
Jump to: navigation, search

GnDropDown

Widget XML tag
<com.ginstr.widgets.GnDropDown>
Description
GnDropDown inherits regular Android Spinner widget.
It provides the entry of dropdown values.
It has two ways of functioning. It can receive values either from local resources or from the database.
The items are sorted by default (ASC).
See gn:act_fill_dropdown for retrieving values from local source.

XML Attributes Description

Attribute Description
gn:s_sourceType Sets source for data load into dropdown

Can be

  • local - Sets the source as array from resources (@array/resourceId)
  • database - Sets the source as database
gn:singleItemMode Enables table with single row to be set as source

Can be

  • true - table data is loaded even if one row is set
  • false - table data is not loaded if one row is set (default)
gn:data_queryType If queries.xml dbRequest used to populate dropdown defines query keys, this attribute can be used to sort the query result
gn:textColor Changes color of zero item

Can be

  • hex color, i.e. #112233
gn:s_ZeroItemText Sets text of choice for zero item of the dropdown

Can be

  • @string
gn:s_title Adds title to selection box of dropdown which is displayed after click on dropdown

Can be

  • @string
gn:s_dataFilters GnDropDown supports filtering like GnListView, please read here how to use filters.
gn:s_sortColumn Defines column used to sort dropdown data

Can be

gn:s_sortOrder Toggles sort order between ascending & descending provided gn:s_sortColumn is defined

Can be

  • regular - sorts from oldest to newest if dateTime, or from A-Z if text
  • reverse - sorts from newest to oldest if dateTime, or from Z-A if text
  • unsorted - sorting is disabled
gn:textSize Sets size of text in widget to defined value

Unit for size (sp) is obligatory.

gn:zeroItemEventEnabled Executes gn:act_setItemSelect actions also when first item in list is selected

Can be

gn:s_listSelector Sets the color of selector when user clicks on row in GnListView
gn:s_decimalFormat Formats dropdown data to specified number format
gn:displayColumns Represents a list of columns which data will be displayed in dropdown data as one item

Can be

  • hardcoded values separated by , character
gn:displayColumnsSeparator Represents a separator for column values

Can be

  • hardcoded
gn:closePopupAfterDataSetOrSelect Closes the popup window after the data is set or item is select

Can be

  • true
  • false
gn:textValidateErrorColor Defines color of the dropdown selected text in case of validation error

Can be

  • if attribute is not present, default is red
  • hex color, i.e. #AABBCC
gn:isZeroItemEnabled Defines if zero item should be shown in dropdown (on english is "Select..."). By defaut zero item is shown in dropdown.

Can be

  • true - zero item will be shown
  • false - zero item will be disabled and not shown
gn:noData (milestone 101)
Defines if dropdown is not populated with data to show a "empty state" on screen load or when "gn:act_cleanWidgets" is used on GnDropdown. Later via some actions this hint will be replaced with content. By default string resource by id $dropDownNoData is used

Can be

  • @string - string resource in strings.xml¸
gn:dialogNoData (milestone 101)
Defines if dropdown is not populated with data to show a message when user clicks on empty GnDropdown. By default string resource by id $dropDownDialogNoData is used

Can be

  • @string - string resource in strings.xml
gn:hideFrequencies (milestone 103)
If dropdown contains frequencies datatype and if attribute is defined then the frequencies listed will not be shown in the list of frequencies.

Can be

  • frequencies - list of comma separated frequencies. i.e. "daily,weekly"
gn:dataType Defines datatype of widget

Example

<com.ginstr.widgets.GnDropDown
  android:id="@+id/constructionSite"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  gn:singleItemMode="true"
  gn:zeroItemEventEnabled="true" />