List page with simple template¶
In this lesson we continue changing our existing application; as basis the code at the end of the previous lesson is used. The goal is to display structured data in form of list using a specific format, the listItemMultiLine. (Details of the List element and list columns are described in the API documentation.)
The final code with listItemMultiLine template¶
After performing the changes described above, the final form of the scolvo script files should be as defined below:
1import {
2 /mobile/note/Notes,
3 /mobile/note/Tags
4}
5
6menu defaultItem Notes {
7 group Notes defaultItem All {
8 item All,
9 item Pinned
10 },
11 item Tags
12}
13
14function onAll(originId) {
15 displayNotesPage(originId);
16}
17
18function onPinned(originId) {
19 display(PinnedPage, {}, originId);
20}
21
22function onTags(originId) {
23 displayTagsPage(originId);
24}
25
26page PinnedPage {
27 layout: vertical;
28 template: general;
29 settingsVisible: true;
30 scolvoMenuVisible: true;
31}
32
33function onPinnedPageLoaded(originId) {}
1function displayNotesPage(originId) {
2 var pageData = getData();
3 var pageDescriptor = {
4 "NotesPage": {
5 "NotesList": pageData
6 }
7 };
8 display(NotesPage, pageDescriptor, originId);
9}
10
11function getData() {
12 return [{"title": "First title","content": "First content"},
13 {"title": "Second title","content": "Second content"}];
14}
15
16page NotesPage {
17 layout: vertical;
18 template: general;
19 settingsVisible: true;
20 scolvoMenuVisible: true;
21
22 list NotesList {
23 template: listVerticalNormal;
24 itemTemplate: listItemCard;
25 span: 0;
26 filterVisible: true;
27
28 actions: []
29 columns: [
30 title => title,
31 text => content
32 ]
33 }
34}
35
36function onNotesPageLoaded(originId) {}
1function displayTagsPage(originId) {
2 var pageData = getTagsData();
3 var pageDescriptor = {
4 "TagsPage": {
5 "TagsList": pageData
6 }
7 };
8 display(TagsPage, pageDescriptor, originId);
9}
10
11function getTagsData() {
12 return [{"title": "First tag"},
13 {"title": "Second tag"}];
14}
15
16page TagsPage {
17 layout: vertical;
18 template: general;
19 settingsVisible: true;
20 scolvoMenuVisible: true;
21
22 list TagsList {
23 template: listVerticalNormal;
24 itemTemplate: listItemMultiLine;
25 span: 0;
26 filterVisible: true;
27
28 actions: []
29 columns: [
30 mainText => title
31 ]
32 }
33}
34
35function onTagsPageLoaded(originId) {}
The content of the dictionary file is as below:
1menu_Notes_label=Notes
2menu_Notes_icon=\ue956
3menu_Notes_All_label=All
4menu_Notes_Pinned_label=Pinned
5menu_Tags_label=Tags
6menu_Tags_icon=\ue93b