slickgrid-rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +75 -0
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/fetch.sh +8 -0
- data/lib/slickgrid-rails.rb +1 -0
- data/lib/slickgrid/rails.rb +5 -0
- data/lib/slickgrid/rails/engine.rb +7 -0
- data/lib/slickgrid/rails/version.rb +6 -0
- data/lib/slickgrid/table.rb +72 -0
- data/slickgrid-rails.gemspec +22 -0
- data/vendor/assets/images/slick/actions.gif +0 -0
- data/vendor/assets/images/slick/ajax-loader-small.gif +0 -0
- data/vendor/assets/images/slick/arrow_redo.png +0 -0
- data/vendor/assets/images/slick/arrow_right_peppermint.png +0 -0
- data/vendor/assets/images/slick/arrow_right_spearmint.png +0 -0
- data/vendor/assets/images/slick/arrow_undo.png +0 -0
- data/vendor/assets/images/slick/bullet_blue.png +0 -0
- data/vendor/assets/images/slick/bullet_star.png +0 -0
- data/vendor/assets/images/slick/bullet_toggle_minus.png +0 -0
- data/vendor/assets/images/slick/bullet_toggle_plus.png +0 -0
- data/vendor/assets/images/slick/calendar.gif +0 -0
- data/vendor/assets/images/slick/collapse.gif +0 -0
- data/vendor/assets/images/slick/comment_yellow.gif +0 -0
- data/vendor/assets/images/slick/down.gif +0 -0
- data/vendor/assets/images/slick/drag-handle.png +0 -0
- data/vendor/assets/images/slick/editor-helper-bg.gif +0 -0
- data/vendor/assets/images/slick/expand.gif +0 -0
- data/vendor/assets/images/slick/header-bg.gif +0 -0
- data/vendor/assets/images/slick/header-columns-bg.gif +0 -0
- data/vendor/assets/images/slick/header-columns-over-bg.gif +0 -0
- data/vendor/assets/images/slick/help.png +0 -0
- data/vendor/assets/images/slick/info.gif +0 -0
- data/vendor/assets/images/slick/listview.gif +0 -0
- data/vendor/assets/images/slick/pencil.gif +0 -0
- data/vendor/assets/images/slick/row-over-bg.gif +0 -0
- data/vendor/assets/images/slick/sort-asc.gif +0 -0
- data/vendor/assets/images/slick/sort-asc.png +0 -0
- data/vendor/assets/images/slick/sort-desc.gif +0 -0
- data/vendor/assets/images/slick/sort-desc.png +0 -0
- data/vendor/assets/images/slick/stripes.png +0 -0
- data/vendor/assets/images/slick/tag_red.png +0 -0
- data/vendor/assets/images/slick/tick.png +0 -0
- data/vendor/assets/images/slick/user_identity.gif +0 -0
- data/vendor/assets/images/slick/user_identity_plus.gif +0 -0
- data/vendor/assets/javascripts/slick.js +4 -0
- data/vendor/assets/javascripts/slick/controls/columnpicker.js +106 -0
- data/vendor/assets/javascripts/slick/controls/pager.js +151 -0
- data/vendor/assets/javascripts/slick/core.js +424 -0
- data/vendor/assets/javascripts/slick/dataview.js +908 -0
- data/vendor/assets/javascripts/slick/editors.js +512 -0
- data/vendor/assets/javascripts/slick/formatters.js +55 -0
- data/vendor/assets/javascripts/slick/grid.js +2783 -0
- data/vendor/assets/javascripts/slick/groupitemmetadataprovider.js +139 -0
- data/vendor/assets/javascripts/slick/plugins/autotooltips.js +48 -0
- data/vendor/assets/javascripts/slick/plugins/cellcopymanager.js +86 -0
- data/vendor/assets/javascripts/slick/plugins/cellrangedecorator.js +64 -0
- data/vendor/assets/javascripts/slick/plugins/cellrangeselector.js +112 -0
- data/vendor/assets/javascripts/slick/plugins/cellselectionmodel.js +92 -0
- data/vendor/assets/javascripts/slick/plugins/checkboxselectcolumn.js +154 -0
- data/vendor/assets/javascripts/slick/plugins/rowmovemanager.js +132 -0
- data/vendor/assets/javascripts/slick/plugins/rowselectionmodel.js +187 -0
- data/vendor/assets/javascripts/slick/remotemodel.js +164 -0
- data/vendor/assets/stylesheets/slick/controls/columnpicker.css +30 -0
- data/vendor/assets/stylesheets/slick/controls/pager.css.scss +41 -0
- data/vendor/assets/stylesheets/slick/default-theme.css.scss +104 -0
- data/vendor/assets/stylesheets/slick/grid.css.scss +158 -0
- metadata +158 -0
@@ -0,0 +1,164 @@
|
|
1
|
+
(function ($) {
|
2
|
+
/***
|
3
|
+
* A sample AJAX data store implementation.
|
4
|
+
* Right now, it's hooked up to load all Apple-related Digg stories, but can
|
5
|
+
* easily be extended to support and JSONP-compatible backend that accepts paging parameters.
|
6
|
+
*/
|
7
|
+
function RemoteModel() {
|
8
|
+
// private
|
9
|
+
var PAGESIZE = 50;
|
10
|
+
var data = {length: 0};
|
11
|
+
var searchstr = "apple";
|
12
|
+
var sortcol = null;
|
13
|
+
var sortdir = 1;
|
14
|
+
var h_request = null;
|
15
|
+
var req = null; // ajax request
|
16
|
+
|
17
|
+
// events
|
18
|
+
var onDataLoading = new Slick.Event();
|
19
|
+
var onDataLoaded = new Slick.Event();
|
20
|
+
|
21
|
+
|
22
|
+
function init() {
|
23
|
+
}
|
24
|
+
|
25
|
+
|
26
|
+
function isDataLoaded(from, to) {
|
27
|
+
for (var i = from; i <= to; i++) {
|
28
|
+
if (data[i] == undefined || data[i] == null) {
|
29
|
+
return false;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
return true;
|
34
|
+
}
|
35
|
+
|
36
|
+
|
37
|
+
function clear() {
|
38
|
+
for (var key in data) {
|
39
|
+
delete data[key];
|
40
|
+
}
|
41
|
+
data.length = 0;
|
42
|
+
}
|
43
|
+
|
44
|
+
|
45
|
+
function ensureData(from, to) {
|
46
|
+
if (req) {
|
47
|
+
req.abort();
|
48
|
+
for (var i = req.fromPage; i <= req.toPage; i++)
|
49
|
+
data[i * PAGESIZE] = undefined;
|
50
|
+
}
|
51
|
+
|
52
|
+
if (from < 0) {
|
53
|
+
from = 0;
|
54
|
+
}
|
55
|
+
|
56
|
+
var fromPage = Math.floor(from / PAGESIZE);
|
57
|
+
var toPage = Math.floor(to / PAGESIZE);
|
58
|
+
|
59
|
+
while (data[fromPage * PAGESIZE] !== undefined && fromPage < toPage)
|
60
|
+
fromPage++;
|
61
|
+
|
62
|
+
while (data[toPage * PAGESIZE] !== undefined && fromPage < toPage)
|
63
|
+
toPage--;
|
64
|
+
|
65
|
+
if (fromPage > toPage || ((fromPage == toPage) && data[fromPage * PAGESIZE] !== undefined)) {
|
66
|
+
// TODO: look-ahead
|
67
|
+
return;
|
68
|
+
}
|
69
|
+
|
70
|
+
var url = "http://services.digg.com/search/stories?query=" + searchstr + "&offset=" + (fromPage * PAGESIZE) + "&count=" + (((toPage - fromPage) * PAGESIZE) + PAGESIZE) + "&appkey=http://slickgrid.googlecode.com&type=javascript";
|
71
|
+
|
72
|
+
switch (sortcol) {
|
73
|
+
case "diggs":
|
74
|
+
url += ("&sort=" + ((sortdir > 0) ? "digg_count-asc" : "digg_count-desc"));
|
75
|
+
break;
|
76
|
+
}
|
77
|
+
|
78
|
+
if (h_request != null) {
|
79
|
+
clearTimeout(h_request);
|
80
|
+
}
|
81
|
+
|
82
|
+
h_request = setTimeout(function () {
|
83
|
+
for (var i = fromPage; i <= toPage; i++)
|
84
|
+
data[i * PAGESIZE] = null; // null indicates a 'requested but not available yet'
|
85
|
+
|
86
|
+
onDataLoading.notify({from: from, to: to});
|
87
|
+
|
88
|
+
req = $.jsonp({
|
89
|
+
url: url,
|
90
|
+
callbackParameter: "callback",
|
91
|
+
cache: true, // Digg doesn't accept the autogenerated cachebuster param
|
92
|
+
success: onSuccess,
|
93
|
+
error: function () {
|
94
|
+
onError(fromPage, toPage)
|
95
|
+
}
|
96
|
+
});
|
97
|
+
req.fromPage = fromPage;
|
98
|
+
req.toPage = toPage;
|
99
|
+
}, 50);
|
100
|
+
}
|
101
|
+
|
102
|
+
|
103
|
+
function onError(fromPage, toPage) {
|
104
|
+
alert("error loading pages " + fromPage + " to " + toPage);
|
105
|
+
}
|
106
|
+
|
107
|
+
function onSuccess(resp) {
|
108
|
+
var from = this.fromPage * PAGESIZE, to = from + resp.count;
|
109
|
+
data.length = parseInt(resp.total);
|
110
|
+
|
111
|
+
for (var i = 0; i < resp.stories.length; i++) {
|
112
|
+
data[from + i] = resp.stories[i];
|
113
|
+
data[from + i].index = from + i;
|
114
|
+
}
|
115
|
+
|
116
|
+
req = null;
|
117
|
+
|
118
|
+
onDataLoaded.notify({from: from, to: to});
|
119
|
+
}
|
120
|
+
|
121
|
+
|
122
|
+
function reloadData(from, to) {
|
123
|
+
for (var i = from; i <= to; i++)
|
124
|
+
delete data[i];
|
125
|
+
|
126
|
+
ensureData(from, to);
|
127
|
+
}
|
128
|
+
|
129
|
+
|
130
|
+
function setSort(column, dir) {
|
131
|
+
sortcol = column;
|
132
|
+
sortdir = dir;
|
133
|
+
clear();
|
134
|
+
}
|
135
|
+
|
136
|
+
function setSearch(str) {
|
137
|
+
searchstr = str;
|
138
|
+
clear();
|
139
|
+
}
|
140
|
+
|
141
|
+
|
142
|
+
init();
|
143
|
+
|
144
|
+
return {
|
145
|
+
// properties
|
146
|
+
"data": data,
|
147
|
+
|
148
|
+
// methods
|
149
|
+
"clear": clear,
|
150
|
+
"isDataLoaded": isDataLoaded,
|
151
|
+
"ensureData": ensureData,
|
152
|
+
"reloadData": reloadData,
|
153
|
+
"setSort": setSort,
|
154
|
+
"setSearch": setSearch,
|
155
|
+
|
156
|
+
// events
|
157
|
+
"onDataLoading": onDataLoading,
|
158
|
+
"onDataLoaded": onDataLoaded
|
159
|
+
};
|
160
|
+
}
|
161
|
+
|
162
|
+
// Slick.Data.RemoteModel
|
163
|
+
$.extend(true, window, { Slick: { Data: { RemoteModel: RemoteModel }}});
|
164
|
+
})(jQuery);
|
@@ -0,0 +1,30 @@
|
|
1
|
+
.slick-columnpicker {
|
2
|
+
border: 1px solid #718BB7;
|
3
|
+
background: #f0f0f0;
|
4
|
+
padding: 6px;
|
5
|
+
-moz-box-shadow: 2px 2px 2px silver;
|
6
|
+
-webkit-box-shadow: 2px 2px 2px silver;
|
7
|
+
min-width: 100px;
|
8
|
+
cursor: default;
|
9
|
+
}
|
10
|
+
|
11
|
+
.slick-columnpicker li {
|
12
|
+
list-style: none;
|
13
|
+
margin: 0;
|
14
|
+
padding: 0;
|
15
|
+
background: none;
|
16
|
+
}
|
17
|
+
|
18
|
+
.slick-columnpicker input {
|
19
|
+
margin: 4px;
|
20
|
+
}
|
21
|
+
|
22
|
+
.slick-columnpicker li a {
|
23
|
+
display: block;
|
24
|
+
padding: 4px;
|
25
|
+
font-weight: bold;
|
26
|
+
}
|
27
|
+
|
28
|
+
.slick-columnpicker li a:hover {
|
29
|
+
background: white;
|
30
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
.slick-pager {
|
2
|
+
width: 100%;
|
3
|
+
height: 26px;
|
4
|
+
border: 1px solid gray;
|
5
|
+
border-top: 0;
|
6
|
+
background: image-url('slick/header-columns-bg.gif') repeat-x center bottom;
|
7
|
+
vertical-align: middle;
|
8
|
+
}
|
9
|
+
|
10
|
+
.slick-pager .slick-pager-status {
|
11
|
+
display: inline-block;
|
12
|
+
padding: 6px;
|
13
|
+
}
|
14
|
+
|
15
|
+
.slick-pager .ui-icon-container {
|
16
|
+
display: inline-block;
|
17
|
+
margin: 2px;
|
18
|
+
border-color: gray;
|
19
|
+
}
|
20
|
+
|
21
|
+
.slick-pager .slick-pager-nav {
|
22
|
+
display: inline-block;
|
23
|
+
float: left;
|
24
|
+
padding: 2px;
|
25
|
+
}
|
26
|
+
|
27
|
+
.slick-pager .slick-pager-settings {
|
28
|
+
display: block;
|
29
|
+
float: right;
|
30
|
+
padding: 2px;
|
31
|
+
}
|
32
|
+
|
33
|
+
.slick-pager .slick-pager-settings * {
|
34
|
+
vertical-align: middle;
|
35
|
+
}
|
36
|
+
|
37
|
+
.slick-pager .slick-pager-settings a {
|
38
|
+
padding: 2px;
|
39
|
+
text-decoration: underline;
|
40
|
+
cursor: pointer;
|
41
|
+
}
|
@@ -0,0 +1,104 @@
|
|
1
|
+
/*
|
2
|
+
IMPORTANT:
|
3
|
+
In order to preserve the uniform grid appearance, all cell styles need to have padding, margin and border sizes.
|
4
|
+
No built-in (selected, editable, highlight, flashing, invalid, loading, :focus) or user-specified CSS
|
5
|
+
classes should alter those!
|
6
|
+
*/
|
7
|
+
|
8
|
+
.slick-header-columns {
|
9
|
+
background: image-url('slick/header-columns-bg.gif') repeat-x center bottom;
|
10
|
+
border-bottom: 1px solid silver;
|
11
|
+
}
|
12
|
+
|
13
|
+
.slick-header-column {
|
14
|
+
background: image-url('slick/header-columns-bg.gif') repeat-x center bottom;
|
15
|
+
border-right: 1px solid silver;
|
16
|
+
}
|
17
|
+
|
18
|
+
.slick-header-column:hover, .slick-header-column-active {
|
19
|
+
background: white image-url('slick/header-columns-over-bg.gif') repeat-x center bottom;
|
20
|
+
}
|
21
|
+
|
22
|
+
.slick-headerrow {
|
23
|
+
background: #fafafa;
|
24
|
+
}
|
25
|
+
|
26
|
+
.slick-headerrow-column {
|
27
|
+
background: #fafafa;
|
28
|
+
border-bottom: 0;
|
29
|
+
height: 100%;
|
30
|
+
}
|
31
|
+
|
32
|
+
.slick-row.ui-state-active {
|
33
|
+
background: #F5F7D7;
|
34
|
+
}
|
35
|
+
|
36
|
+
.slick-row {
|
37
|
+
position: absolute;
|
38
|
+
background: white;
|
39
|
+
border: 0px;
|
40
|
+
line-height: 20px;
|
41
|
+
}
|
42
|
+
|
43
|
+
.slick-row.selected {
|
44
|
+
z-index: 10;
|
45
|
+
background: #DFE8F6;
|
46
|
+
}
|
47
|
+
|
48
|
+
.slick-cell {
|
49
|
+
padding-left: 4px;
|
50
|
+
padding-right: 4px;
|
51
|
+
}
|
52
|
+
|
53
|
+
.slick-group {
|
54
|
+
border-bottom: 2px solid silver;
|
55
|
+
}
|
56
|
+
|
57
|
+
.slick-group-toggle {
|
58
|
+
width: 9px;
|
59
|
+
height: 9px;
|
60
|
+
margin-right: 5px;
|
61
|
+
}
|
62
|
+
|
63
|
+
.slick-group-toggle.expanded {
|
64
|
+
background: image-url('slick/collapse.gif') no-repeat center center;
|
65
|
+
}
|
66
|
+
|
67
|
+
.slick-group-toggle.collapsed {
|
68
|
+
background: image-url('slick/expand.gif') no-repeat center center;
|
69
|
+
}
|
70
|
+
|
71
|
+
.slick-group-totals {
|
72
|
+
color: gray;
|
73
|
+
background: white;
|
74
|
+
}
|
75
|
+
|
76
|
+
.slick-cell.selected {
|
77
|
+
background-color: beige;
|
78
|
+
}
|
79
|
+
|
80
|
+
.slick-cell.active {
|
81
|
+
border-color: gray;
|
82
|
+
border-style: solid;
|
83
|
+
}
|
84
|
+
|
85
|
+
.slick-sortable-placeholder {
|
86
|
+
background: silver !important;
|
87
|
+
}
|
88
|
+
|
89
|
+
.slick-row[row$="1"], .slick-row[row$="3"], .slick-row[row$="5"], .slick-row[row$="7"], .slick-row[row$="9"] {
|
90
|
+
background: #fafafa;
|
91
|
+
}
|
92
|
+
|
93
|
+
.slick-row.ui-state-active {
|
94
|
+
background: #F5F7D7;
|
95
|
+
}
|
96
|
+
|
97
|
+
.slick-row.loading {
|
98
|
+
opacity: 0.5;
|
99
|
+
filter: alpha(opacity = 50);
|
100
|
+
}
|
101
|
+
|
102
|
+
.slick-cell.invalid {
|
103
|
+
border-color: red;
|
104
|
+
}
|
@@ -0,0 +1,158 @@
|
|
1
|
+
/*
|
2
|
+
IMPORTANT:
|
3
|
+
In order to preserve the uniform grid appearance, all cell styles need to have padding, margin and border sizes.
|
4
|
+
No built-in (selected, editable, highlight, flashing, invalid, loading, :focus) or user-specified CSS
|
5
|
+
classes should alter those!
|
6
|
+
*/
|
7
|
+
|
8
|
+
.slick-header.ui-state-default, .slick-headerrow.ui-state-default {
|
9
|
+
width: 100%;
|
10
|
+
overflow: hidden;
|
11
|
+
border-left: 0px;
|
12
|
+
}
|
13
|
+
|
14
|
+
.slick-header-columns, .slick-headerrow-columns {
|
15
|
+
width: 999999px;
|
16
|
+
position: relative;
|
17
|
+
white-space: nowrap;
|
18
|
+
cursor: default;
|
19
|
+
overflow: hidden;
|
20
|
+
}
|
21
|
+
|
22
|
+
.slick-header-column.ui-state-default {
|
23
|
+
position: relative;
|
24
|
+
display: inline-block;
|
25
|
+
overflow: hidden;
|
26
|
+
text-overflow: ellipsis;
|
27
|
+
height: 16px;
|
28
|
+
line-height: 16px;
|
29
|
+
margin: 0;
|
30
|
+
padding: 4px;
|
31
|
+
border-right: 1px solid silver;
|
32
|
+
border-left: 0px;
|
33
|
+
border-top: 0px;
|
34
|
+
border-bottom: 0px;
|
35
|
+
float: left;
|
36
|
+
}
|
37
|
+
|
38
|
+
.slick-headerrow-column.ui-state-default {
|
39
|
+
padding: 4px;
|
40
|
+
}
|
41
|
+
|
42
|
+
.slick-header-column-sorted {
|
43
|
+
font-style: italic;
|
44
|
+
}
|
45
|
+
|
46
|
+
.slick-sort-indicator {
|
47
|
+
display: inline-block;
|
48
|
+
width: 8px;
|
49
|
+
height: 5px;
|
50
|
+
margin-left: 4px;
|
51
|
+
}
|
52
|
+
|
53
|
+
.slick-sort-indicator-desc {
|
54
|
+
background: image-url('slick/sort-desc.gif');
|
55
|
+
}
|
56
|
+
|
57
|
+
.slick-sort-indicator-asc {
|
58
|
+
background: image-url('slick/sort-asc.gif');
|
59
|
+
}
|
60
|
+
|
61
|
+
.slick-resizable-handle {
|
62
|
+
position: absolute;
|
63
|
+
font-size: 0.1px;
|
64
|
+
display: block;
|
65
|
+
cursor: col-resize;
|
66
|
+
width: 4px;
|
67
|
+
right: 0px;
|
68
|
+
top: 0;
|
69
|
+
height: 100%;
|
70
|
+
}
|
71
|
+
|
72
|
+
.slick-sortable-placeholder {
|
73
|
+
background: silver;
|
74
|
+
}
|
75
|
+
|
76
|
+
.grid-canvas {
|
77
|
+
position: relative;
|
78
|
+
outline: 0;
|
79
|
+
}
|
80
|
+
|
81
|
+
.slick-row.ui-widget-content, .slick-row.ui-state-active {
|
82
|
+
position: absolute;
|
83
|
+
border: 0px;
|
84
|
+
width: 100%;
|
85
|
+
}
|
86
|
+
|
87
|
+
.slick-cell, .slick-headerrow-column {
|
88
|
+
position: absolute;
|
89
|
+
|
90
|
+
border: 1px solid transparent;
|
91
|
+
border-right: 1px dotted silver;
|
92
|
+
border-bottom-color: silver;
|
93
|
+
|
94
|
+
overflow: hidden;
|
95
|
+
text-overflow: ellipsis;
|
96
|
+
white-space: nowrap;
|
97
|
+
vertical-align: middle;
|
98
|
+
z-index: 1;
|
99
|
+
padding: 1px 2px 2px 1px;
|
100
|
+
margin: 0;
|
101
|
+
|
102
|
+
white-space: nowrap;
|
103
|
+
|
104
|
+
cursor: default;
|
105
|
+
}
|
106
|
+
|
107
|
+
.slick-group {
|
108
|
+
}
|
109
|
+
|
110
|
+
.slick-group-toggle {
|
111
|
+
display: inline-block;
|
112
|
+
}
|
113
|
+
|
114
|
+
.slick-cell.highlighted {
|
115
|
+
background: lightskyblue;
|
116
|
+
background: rgba(0, 0, 255, 0.2);
|
117
|
+
-webkit-transition: all 0.5s;
|
118
|
+
-moz-transition: all 0.5s;
|
119
|
+
transition: all 0.5s;
|
120
|
+
}
|
121
|
+
|
122
|
+
.slick-cell.flashing {
|
123
|
+
border: 1px solid red !important;
|
124
|
+
}
|
125
|
+
|
126
|
+
.slick-cell.editable {
|
127
|
+
z-index: 11;
|
128
|
+
overflow: visible;
|
129
|
+
background: white;
|
130
|
+
border-color: black;
|
131
|
+
border-style: solid;
|
132
|
+
}
|
133
|
+
|
134
|
+
.slick-cell:focus {
|
135
|
+
outline: none;
|
136
|
+
}
|
137
|
+
|
138
|
+
.slick-reorder-proxy {
|
139
|
+
display: inline-block;
|
140
|
+
background: blue;
|
141
|
+
opacity: 0.15;
|
142
|
+
filter: alpha(opacity = 15);
|
143
|
+
cursor: move;
|
144
|
+
}
|
145
|
+
|
146
|
+
.slick-reorder-guide {
|
147
|
+
display: inline-block;
|
148
|
+
height: 2px;
|
149
|
+
background: blue;
|
150
|
+
opacity: 0.7;
|
151
|
+
filter: alpha(opacity = 70);
|
152
|
+
}
|
153
|
+
|
154
|
+
.slick-selection {
|
155
|
+
z-index: 10;
|
156
|
+
position: absolute;
|
157
|
+
border: 2px dashed black;
|
158
|
+
}
|