From wiki.ginstr.com
Revision as of 15:59, 12 July 2017 by Mark (talk | contribs)
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.
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

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" />