-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui_listPage.js
53 lines (41 loc) · 1.35 KB
/
ui_listPage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"use strict";
var uiListPage = {
init: function(divId, itemClickFunc) {
this._div = "#"+divId;
this._list = "#"+divId+"-ul";
this._click = function (e) {
itemClickFunc($(e.target).data("act"));
return false;
}
},
pageInit: function () {
$(this._div).css("display", "none");
$(this._div).html("");
$(this._div).append(
$('<ul>').attr('style', 'list-style: none; padding: 0;').attr('id', this._list.slice(1)));
},
pageEnter: function (mdItems) {
// reset to empty
$(this._list).empty();
$(this._list).append(
$('<li>').attr('class', 'col-sm-3').append(
$('<div>').attr('class', 'md-entry md-new h4').append(
$('<a>').attr('href','#').click(this._click).append(
$('<span>').attr('class', 'glyphicon glyphicon-plus')).append("New Note")
)));
for(var i=0;i<mdItems.length;i++)
{
var item = mdItems[i];
$(this._list).append(
$('<li>').attr('class', 'col-sm-3').append(
$('<div>').attr('class', 'md-entry h4').append(
$('<a>').attr('href','#').data('act',item.id).click(this._click).append(
$('<span>').attr('class', 'glyphicon glyphicon-file')).append(item.name)
)));
}
$(this._div).css("display", "block");
},
pageLeave: function () {
$(this._div).css("display", "none");
},
};