Skip to content

Commit 674aeb1

Browse files
committed
release v2.4.8 - update github.io
1 parent 8bff501 commit 674aeb1

10 files changed

Lines changed: 73 additions & 26 deletions

SlickGrid/controls/slick.columnpicker.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
} else {
112112
columnLabel = defaults.headerColumnValueExtractor(columns[i]);
113113
}
114-
114+
115115
$("<label />")
116116
.html(columnLabel)
117117
.prepend($input)
@@ -176,7 +176,16 @@
176176
ordered[i] = current.shift();
177177
}
178178
}
179-
columns = ordered;
179+
180+
// filter out excluded column header when necessary
181+
// (works with IE9+, older browser requires a polyfill for the filter to work, visit MDN for more info)
182+
if (Array.isArray(ordered) && typeof ordered.filter === 'function') {
183+
columns = ordered.filter(function(columnDef) {
184+
return !columnDef.excludeFromColumnPicker;
185+
});
186+
} else {
187+
columns = ordered;
188+
}
180189
}
181190

182191
function updateColumn(e) {

SlickGrid/controls/slick.gridmenu.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,16 @@
384384
ordered[i] = current.shift();
385385
}
386386
}
387-
columns = ordered;
387+
388+
// filter out excluded column header when necessary
389+
// (works with IE9+, older browser requires a polyfill for the filter to work, visit MDN for more info)
390+
if (Array.isArray(ordered) && typeof ordered.filter === 'function') {
391+
columns = ordered.filter(function(columnDef) {
392+
return !columnDef.excludeFromGridMenu;
393+
});
394+
} else {
395+
columns = ordered;
396+
}
388397
}
389398

390399
function updateColumn(e) {

SlickGrid/examples/example-grid-menu.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ <h2>View Source:</h2>
137137
]
138138
}
139139
};
140-
var columns = [];
140+
var columns = [{ id: 'id', field: 'id', name: '#', width: 40, excludeFromGridMenu: true }];
141141
var columnFilters = {};
142142

143143
for (var i = 0; i < 10; i++) {

SlickGrid/examples/example16-row-detail.html

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@
7373
border: 1px solid #ccc;
7474
border-top: none;
7575
}
76+
.options-panel {
77+
width: 375px;
78+
}
7679
</style>
7780
</head>
7881
<body>
@@ -87,31 +90,43 @@ <h2>Demonstrates:</h2>
8790
<ul>
8891
<li>RowDetailView Plugin</li>
8992
<li>See more detail of an item by toggling a row detail panel.<li></li>
90-
<li>User can override the logic to display the expandable icon with "expandableOverride". e.g. every 2nd rows is selectable</li>
91-
<li>"useRowClick: True" to toggle from any column</li>
92-
<li>"useRowClick: False" to toggle from the toggle icon only</li>
93-
<li>"panelRows: 4" DetailView is RowHeight * 4</li>
94-
<li>"loadOnce: True" Try shrink and reopen same row</li>
95-
<li>"loadOnce: False DEFAULT" Will call load every time row is expanded</li>
93+
<li>User can override the logic to display the expandable icon with "expandableOverride". e.g. every 2nd rows is selectable.</li>
94+
<li>"useRowClick: True" to toggle from any column.</li>
95+
<li>"useRowClick: False" to toggle from the toggle icon only.</li>
96+
<li>"panelRows: 4" DetailView is (RowHeight * 4).</li>
97+
<li>"loadOnce: True" Try to shrink and reopen the same row.</li>
98+
<li>"loadOnce: False DEFAULT" Will call load every time row is expanded.</li>
99+
<li>"singleRowExpand: True" Multiple rows can be expanded at any time.</li>
100+
<li>"singleRowExpand: False DEFAULT" Will only expand 1 row at a time.</li>
96101
<li>&nbsp;</li>
97-
<li>Example of using non templated view e.g. check any row multiple of 5<li>
102+
<li>Example of using non templated view e.g. check any row multiple of 5.<li>
98103
</ul>
99104

100105
<h2>Options:</h2>
101-
<button onclick="detailView.setOptions({ loadOnce: true, useRowClick: detailView.useRowClick })">Load Once ON</button>
102-
&nbsp;
103-
<button onclick="detailView.setOptions({ loadOnce: false, useRowClick: detailView.useRowClick})">Load Once OFF</button>
106+
<p>
107+
<button onclick="detailView.setOptions({ loadOnce: true, useRowClick: detailView.useRowClick })">Load Once ON</button>
108+
&nbsp;
109+
<button onclick="detailView.setOptions({ loadOnce: false, useRowClick: detailView.useRowClick})">Load Once OFF</button>
110+
</p>
104111
<p>
105112
<input type="number" id="panelRowInput"/> <button onclick="setPanelRows()">Set Panel Rows Option</button>
106113
</p>
107114
<p>
108115
<input type="number" id="maxRowInput"/> <button onclick="setMaxRows()">Set Max Panel Rows Option</button>
109116
</p>
110117
<p>
111-
<button onclick="detailView.setOptions({ loadOnce: detailView.loadOnce, useRowClick: true })">Row Click ON</button>
112-
&nbsp;
113-
<button onclick="detailView.setOptions({ loadOnce: detailView.loadOnce, useRowClick: false })">Row Click OFF</button>
114-
118+
Click anywhere on the row to expand:
119+
<p>
120+
<button onclick="detailView.setOptions({ loadOnce: detailView.loadOnce, useRowClick: true })">Row Click ON</button>
121+
&nbsp;
122+
<button onclick="detailView.setOptions({ loadOnce: detailView.loadOnce, useRowClick: false })">Row Click OFF</button>
123+
</p>
124+
How many rows cab be opened at a time (defaults to multiple):
125+
<p>
126+
<button onclick="detailView.setOptions({ singleRowExpand: true })">Single Row Expand ON</button>
127+
&nbsp;
128+
<button onclick="detailView.setOptions({ singleRowExpand: false })">Single Row Expand OFF (multiple)</button>
129+
</p>
115130
<h2>View Source:</h2>
116131
<ul>
117132
<li><A href="https://github.com/6pac/SlickGrid/blob/master/examples/example16-row-detail.html" target="_sourcewindow"> View the source for this example on Github</a></li>

SlickGrid/examples/example4-model.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ <h2>View Source:</h2>
115115
var grid;
116116
var data = [];
117117
var columns = [
118-
{id: "sel", name: "#", field: "num", behavior: "select", cssClass: "cell-selection", width: 40, cannotTriggerInsert: true, resizable: false, selectable: false },
118+
{id: "sel", name: "#", field: "num", behavior: "select", cssClass: "cell-selection", width: 40, cannotTriggerInsert: true, resizable: false, selectable: false, excludeFromColumnPicker: true },
119119
{id: "title", name: "Title", field: "title", width: 120, minWidth: 120, cssClass: "cell-title", editor: Slick.Editors.Text, validator: requiredFieldValidator, sortable: true},
120120
{id: "duration", name: "Duration", field: "duration", editor: Slick.Editors.Text, sortable: true},
121121
{id: "%", defaultSortAsc: false, name: "% Complete", field: "percentComplete", width: 80, resizable: false, formatter: Slick.Formatters.PercentCompleteBar, editor: Slick.Editors.PercentComplete, sortable: true},
@@ -128,7 +128,7 @@ <h2>View Source:</h2>
128128
columnPicker: {
129129
columnTitle: "Columns",
130130
hideForceFitButton: false,
131-
hideSyncResizeButton: false,
131+
hideSyncResizeButton: false,
132132
forceFitTitle: "Force fit columns",
133133
syncResizeTitle: "Synchronous resize",
134134
},

SlickGrid/lib/jquery.event.drag-2.3.0.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@
146146
// locate and init the drop targets
147147
if ( dd.drop !== false && $special.drop )
148148
$special.drop.handler( event, dd );
149+
// if user is not dragging
150+
if(!dd.click && dd.distance === 0 && !dd.dragging) {
151+
drag.textselect( true );
152+
return;
153+
}
149154
// disable text selection
150155
drag.textselect( false );
151156
// bind additional events...

SlickGrid/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "slickgrid",
3-
"version": "2.4.7",
3+
"version": "2.4.8",
44
"description": "A lightning fast JavaScript grid/spreadsheet",
55
"main": "slick.core.js",
66
"directories": {

SlickGrid/plugins/slick.rowdetailview.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* postTemplate: Template that will be loaded once the async function finishes
1818
* process: Async server function call
1919
* panelRows: Row count to use for the template panel
20+
* singleRowExpand: Defaults to false, limit expanded row to 1 at a time.
2021
* useRowClick: Boolean flag, when True will open the row detail on a row click (from any column), default to False
2122
* keyPrefix: Defaults to '_', prefix used for all the plugin metadata added to the item object (meta e.g.: padding, collapsed, parent)
2223
* collapseAllOnSort: Defaults to true, which will collapse all row detail views when user calls a sort. Unless user implements a sort to deal with padding
@@ -109,6 +110,7 @@
109110
loadOnce: false,
110111
collapseAllOnSort: true,
111112
saveDetailViewOnScroll: true,
113+
singleRowExpand: false,
112114
useSimpleViewportCalc: false,
113115
alwaysRenderColumn: true,
114116
toolTip: '',
@@ -198,6 +200,9 @@
198200
/** set or change some of the plugin options */
199201
function setOptions(options) {
200202
_options = $.extend(true, {}, _options, options);
203+
if (_options && _options.singleRowExpand) {
204+
collapseAll();
205+
}
201206
}
202207

203208
/** Find a value in an array and return the index when (or -1 when not found) */
@@ -459,6 +464,10 @@
459464

460465
/** Expand a row given the dataview item that is to be expanded */
461466
function expandDetailView(item) {
467+
if (_options && _options.singleRowExpand) {
468+
collapseAll();
469+
}
470+
462471
item[_keyPrefix + 'collapsed'] = false;
463472
_expandedRows.push(item);
464473

@@ -651,7 +660,7 @@
651660
html.push('<div class="dynamic-cell-detail cellDetailView_', dataContext.id, '" '); //apply custom css to detail
652661
html.push('style="height:', outterHeight, 'px;'); //set total height of padding
653662
html.push('top:', rowHeight, 'px">'); //shift detail below 1st row
654-
html.push('<div class="detail-container detailViewContainer_', dataContext.id, '" style="min-height:' + dataContext[_keyPrefix + 'height'] + 'px">'); //sub ctr for custom styling
663+
html.push('<div class="detail-container detailViewContainer_', dataContext.id, '">'); //sub ctr for custom styling
655664
html.push('<div class="innerDetailView_', dataContext.id, '">', dataContext[_keyPrefix + 'detailContent'], '</div></div>');
656665
// &omit a final closing detail container </div> that would come next
657666

SlickGrid/plugins/slick.sizetocontent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
// .rowSelectionModeOnInit: undefined (FirstRow, LastRow)
6565
// .rowSelectionMode: FirstNRows (FirstRow, FirstNRows, AllRows)
6666
// .rowSelectionCount: 100
67-
// .valueFilterMode: None (None, DeDuplicate, GetGreatest, GetLongestText, CompareFunction())
67+
// .valueFilterMode: None (None, DeDuplicate, GetGreatest, GetLongestText, CompareFunction(), FilterFunction())
6868
// .widthEvalMode: HTML (CanvasTextSize, HTML)
6969
// .sizeToRemaining: undefined
7070
//

SlickGrid/slick.grid.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ if (typeof Slick === "undefined") {
616616
}
617617

618618
function getPluginByName(name) {
619-
for (var i = plugins.length; i >= 0; i--) {
619+
for (var i = plugins.length-1; i >= 0; i--) {
620620
if (plugins[i].pluginName === name) {
621621
return plugins[i];
622622
}
@@ -4112,7 +4112,7 @@ if (typeof Slick === "undefined") {
41124112
for (var row in rowsCache) {
41134113
for (var i in rowsCache[row].rowNode) {
41144114
if (rowsCache[row].rowNode[i] === rowNode)
4115-
return row | 0;
4115+
return (row ? parseInt(row) : 0);
41164116
}
41174117
}
41184118
return null;
@@ -5210,7 +5210,7 @@ if (typeof Slick === "undefined") {
52105210
// Public API
52115211

52125212
$.extend(this, {
5213-
"slickGridVersion": "2.4.7",
5213+
"slickGridVersion": "2.4.8",
52145214

52155215
// Events
52165216
"onScroll": new Slick.Event(),

0 commit comments

Comments
 (0)