new ludo.layout.ViewPager(config)
The ViewPager layout displays one child view at a time. You can swipe between pages or
go to a specific page using code.
For demo, see View Pager demo
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
Object |
Properties
|
- Source:
Properties:
Name | Type | Description |
---|---|---|
count |
Number | Count child views |
selectedIndex |
Number | Index of currently selected child view |
Fires:
- ludo.layout.ViewPager#showpage - Event fired when a page is displayed. To add listeners, add a listeners object to your layout.
Example:
layout:{ type:'ViewPager', listeners: { "showpage": function(){ } }}
event: - ludo.layout.ViewPager#lowerpage - Navigated back to a one of it's previous sibling views.event: Many of these events are useful for toggling buttons(enable/disable).
- ludo.layout.ViewPager#event:higherpage - Navigated to one of it's next sibling views
- ludo.layout.ViewPager#event:lastpage - Navigated to last child view
- ludo.layout.ViewPager#event:notlastpage - Navigated to a child view which is not last.
- ludo.layout.ViewPager#event:firstpage - Navigated to first child view
- ludo.layout.ViewPager#event:notfirstpage - Navigated to a page which is different than first child view.
- ludo.layout.ViewPager#event:valid - Fired when all form views on current shown child view is valid
- ludo.layout.ViewPager#event:invalid - Fired when visible child view has a form view with invalid value.
Members
-
count
-
Number of child views/pages in view pager layout
- Source:
Properties:
Name Type Description count
Number -
selectedIndex
-
Index of selected page
- Source:
Properties:
Name Type Description selectedIndex
Number
Methods
-
goToPage(pageIndex, animate) → {boolean}
-
Go to a specific page index(0 = first page)
Parameters:
Name Type Description pageIndex
Number page index
animate
Boolean Animate transition, Optional parameter, default true
- Source:
Returns:
navigation successful. will return false on invalid index.
- Type
- boolean
-
nextPage(animate) → {Boolean}
-
Show next card of current visible card
Parameters:
Name Type Description animate
Boolean Animate transition, default: true
- Source:
Returns:
success
- Type
- Boolean
-
previousPage(animate) → {Boolean}
-
Show previous card of current visible card
Parameters:
Name Type Description animate
Boolean Animate transition. Optional parameter, default: true
- Source:
Returns:
success
- Type
- Boolean
-
showFirstPage()
-
Go to first child view
- Source:
Returns:
void
-
showLastPage()
-
Go to last page
- Source:
Returns:
void
-
showPage(name) → {Boolean}
-
Show Child View with this name
Parameters:
Name Type Description name
String - Source:
Returns:
success
- Type
- Boolean