m |
m |
||
Line 81: | Line 81: | ||
==Database sourceType and saving to database== | ==Database sourceType and saving to database== | ||
− | When GnDropDown has <code>sourceType="database"</code>, the following attributes are necessary for correct save: | + | When <code>[[GnDropDown]]</code> has <code>sourceType="database"</code>, the following attributes are necessary for correct save: |
;<code>gn:data_request</code>: dbRequest to which data is written | ;<code>gn:data_request</code>: dbRequest to which data is written | ||
::''(String)'' values = <code>tableName</code> | ::''(String)'' values = <code>tableName</code> |
Revision as of 22:56, 28 June 2016
- Inherited classes
View
- Android class type
Spinner
- Child elements
EditText
,Button
- Widget XML tag
<com.ginstr.widgets.GnDropDown>
Widget provides the entry of dropdown values.
GnDropDown
has two ways of functioning. It can receive values either from local resources or from the database. When it’s connected to a database it needs to have a definition of the data. See action for fill dropdown.
XML Attributes Description
Note: An attribute marked with asterisk (*) is a mandatory parameter when creating widget.
Attribute | Description |
---|---|
gn:s_sourceType *
|
Sets source for data load into dropdown. If the attribute is omitted it sets database as source |
gn:singleItemMode
|
Enables table with single row to be set as source |
gn:data_queryType
|
If queries.xml dbRequest that is used for populate dropdown defines query keys, then this attribute can be used to sort the query result
|
gn:textColor
|
Changes color of zero item |
gn:s_ZeroItemText
|
Sets text of choice for zero item of the dropdown |
gn:s_title
|
Adds title to selection box of dropdown which is displayed after click on dropdown |
gn:s_dataFilters
|
GnDropdown supports filtering like GnListView , please read here how to use filters.
|
gn:s_sortColumn
|
Defines column from associated dbRequest used to sort dropdown data |
gn:s_sortOrder
|
Toggles sort order between ascending & descending provided gn:s_sortColumn is defined
|
gn:zeroItemEventEnabled
|
Executes gn:act_setItemSelect actions also when first item in list
|
android:enabled
|
Used to disable GnDropdown so that user can not interact with it
|
gn:s_listSelector
|
Sets the color of selector when user clicks on row in GnListView
|
gn:event_afterDropdownClosed
|
Defines Action Set to be executed when dropdown selection window is closed. |
Local sourceType and saving to database
When GnDropDown
has sourceType="local"
, the following attributes are necessary in order to perform a correct save:
gn:data_request
- dbRequest to which data is written
- (String) values =
tableName
- (String) values =
gn:data_field
- column to which data is saved
- (String) values =
column-Name
- (String) values =
gn:data_source_request
- this attribute that points to dbRequest is not used but it’s necessary because of ginstr launcher internals, it will be removed later. At present it’s necessary that this attribute is provided which points to some dbRequest in queries.xml, the dbRequest should not be used.
i.e. <source lang="xml"> <com.ginstr.widgets.GnDropDown gn:s_sourceType=”local” gn:data_field= “columnOne” gn:data_request=”tableName” gn:data_source_key_local=”@array/drop_values” gn:data_source_request=”unusedDbRequest” gn:act_afterLoad=”[gn:act_fill_dropdown]|[@+id/dropdown]” </source>
The above example will populate a dropdown with local values from “drop_values”
array and a save to the database is performed, data will be saved to table “tableName”
into “columnOne”
.
Database sourceType and saving to database
When GnDropDown
has sourceType="database"
, the following attributes are necessary for correct save:
gn:data_request
- dbRequest to which data is written
- (String) values =
tableName
- (String) values =
gn:data_field
- column to which data is saved
- (String) values =
column-Name
- (String) values =
gn:data_source_field
- name of database field which will be displayed as value
- (String) values =
columnName
- (String) values =
gn:data_source_request
- name of dbRequest from which data is retrieved, values
- (String) values =
tableName
- (String) values =