Module DataList
Component to manage data for huge dataset in scroll.
It requires Druid Scroll and Druid Grid (Static or Dynamic) components
Functions
add(self, data, index, shift_policy) | Add element to DataList. |
clear(self) | Clear the DataList and refresh visuals |
get_created_components(self) | Return all currenly created components in DataList |
get_created_nodes(self) | Return all currenly created nodes in DataList |
get_data(self) | Return current data from DataList component |
get_index(self, data) | Return index for data value |
init(self, scroll, grid, create_function) | The DataList constructor |
on_remove(self) | Druid System on_remove function |
remove(self, index, shift_policy) | Remove element from DataList. |
remove_by_data(self, data, shift_policy) | Remove element from DataList by data value. |
scroll_to_index(self, index) | Instant scroll to element with passed index |
set_data(self, data) | Set new data set for DataList component |
set_use_cache(self, is_use_cache) | Set refresh function for DataList component |
Fields
grid | The Druid Grid component |
last_index | The current last index of visual elements |
on_element_add | On DataList visual element created Event callback(self, index, node, instance) |
on_element_remove | On DataList visual element created Event callback(self, index) |
on_scroll_progress_change | Event triggered when scroll progress is changed; event(self, progress_value) |
scroll | The Druid scroll component |
scroll_progress | The current progress of scroll posititon |
top_index | The current top index of visual elements |
Functions
- add(self, data, index, shift_policy)
-
Add element to DataList. Currenly untested
Parameters:
- clear(self)
-
Clear the DataList and refresh visuals
Parameters:
- self DataList DataList
- get_created_components(self)
-
Return all currenly created components in DataList
Parameters:
- self DataList DataList
Returns:
-
druid.base_component[]
List of created nodes
- get_created_nodes(self)
-
Return all currenly created nodes in DataList
Parameters:
- self DataList DataList
Returns:
-
node[]
List of created nodes
- get_data(self)
-
Return current data from DataList component
Parameters:
- self DataList DataList
Returns:
-
table
The current data array
- get_index(self, data)
-
Return index for data value
Parameters:
- init(self, scroll, grid, create_function)
-
The DataList constructor
Parameters:
- self DataList DataList
- scroll Scroll The Scroll instance for Data List component
- grid StaticGrid The StaticGrid or DynamicGrid instance for Data List component
- create_function function The create function callback(self, data, index, data_list). Function should return (node, [component])
- on_remove(self)
-
Druid System on_remove function
Parameters:
- self DataList DataList
- remove(self, index, shift_policy)
-
Remove element from DataList. Currenly untested
Parameters:
- self DataList DataList
- index number or nil
- shift_policy number or nil The constant from const.SHIFT.*
- remove_by_data(self, data, shift_policy)
-
Remove element from DataList by data value. Currenly untested
Parameters:
- scroll_to_index(self, index)
-
Instant scroll to element with passed index
Parameters:
- self DataList DataList
- index number
- set_data(self, data)
-
Set new data set for DataList component
Parameters:
Returns:
-
druid.data_list
Current DataList instance
- set_use_cache(self, is_use_cache)
-
Set refresh function for DataList component
Parameters:
- self DataList DataList
- is_use_cache boolean Use cache version of DataList. Requires make setup of components in on_element_add callback and clean in on_element_remove
Returns:
-
druid.data_list
Current DataList instance
Fields
- grid
-
The Druid Grid component
- grid StaticGrid StaticGrid, DynamicGrid
- last_index
-
The current last index of visual elements
- last_index number
- on_element_add
-
On DataList visual element created Event callback(self, index, node, instance)
- on_element_add DruidEvent DruidEvent
- on_element_remove
-
On DataList visual element created Event callback(self, index)
- on_element_remove DruidEvent DruidEvent
- on_scroll_progress_change
-
Event triggered when scroll progress is changed; event(self, progress_value)
- on_scroll_progress_change DruidEvent DruidEvent
- scroll
-
The Druid scroll component
- scroll Scroll Scroll
- scroll_progress
-
The current progress of scroll posititon
- scroll_progress number
- top_index
-
The current top index of visual elements
- top_index number