-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjquery.mswin.listview.js
More file actions
49 lines (44 loc) · 1.61 KB
/
Copy pathjquery.mswin.listview.js
File metadata and controls
49 lines (44 loc) · 1.61 KB
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
(function ($, undefined) {
$.widget("mswin.listview", {
_create: function () {
this.refresh();
this._on({
"mousedown .ui-listview-item": function (event) {
this.select(event.currentTarget);
},
"mousedown td": function (event) {
this.select(event.currentTarget);
},
"blur .ui-listview-item": function (event) {
$(event.currentTarget).removeClass("ui-focused");
},
});
},
refresh: function () {
if (this.element.is(".listview-largeicon")) {
this.items = this.element.find("li");
this.items
.addClass("ui-listview-item")
.each(function () {
var elem = $(this).children("span");
elem.css({
width: elem.width() + 2 + "px",
display: "inline-block",
});
});
}
else if (this.element.is(".listview-report-icon")) {
this.items = this.element.find("td");
this.items.addClass("ui-listview-item");
}
},
select: function (item) {
// assumes the item is in this.items
$(".ui-focused").removeClass("ui-focused");
this.items.removeClass("ui-selected");
$(item)
.addClass("ui-focused")
.addClass("ui-selected");
},
});
}(jQuery));