You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<buttononclick="detailView.setOptions({ singleRowExpand: false })">Single Row Expand OFF (multiple)</button>
129
+
</p>
115
130
<h2>View Source:</h2>
116
131
<ul>
117
132
<li><Ahref="https://github.com/6pac/SlickGrid/blob/master/examples/example16-row-detail.html" target="_sourcewindow"> View the source for this example on Github</a></li>
Copy file name to clipboardExpand all lines: SlickGrid/plugins/slick.rowdetailview.js
+10-1Lines changed: 10 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,7 @@
17
17
* postTemplate: Template that will be loaded once the async function finishes
18
18
* process: Async server function call
19
19
* panelRows: Row count to use for the template panel
20
+
* singleRowExpand: Defaults to false, limit expanded row to 1 at a time.
20
21
* useRowClick: Boolean flag, when True will open the row detail on a row click (from any column), default to False
21
22
* keyPrefix: Defaults to '_', prefix used for all the plugin metadata added to the item object (meta e.g.: padding, collapsed, parent)
22
23
* 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 @@
109
110
loadOnce: false,
110
111
collapseAllOnSort: true,
111
112
saveDetailViewOnScroll: true,
113
+
singleRowExpand: false,
112
114
useSimpleViewportCalc: false,
113
115
alwaysRenderColumn: true,
114
116
toolTip: '',
@@ -198,6 +200,9 @@
198
200
/** set or change some of the plugin options */
199
201
functionsetOptions(options){
200
202
_options=$.extend(true,{},_options,options);
203
+
if(_options&&_options.singleRowExpand){
204
+
collapseAll();
205
+
}
201
206
}
202
207
203
208
/** Find a value in an array and return the index when (or -1 when not found) */
@@ -459,6 +464,10 @@
459
464
460
465
/** Expand a row given the dataview item that is to be expanded */
461
466
functionexpandDetailView(item){
467
+
if(_options&&_options.singleRowExpand){
468
+
collapseAll();
469
+
}
470
+
462
471
item[_keyPrefix+'collapsed']=false;
463
472
_expandedRows.push(item);
464
473
@@ -651,7 +660,7 @@
651
660
html.push('<div class="dynamic-cell-detail cellDetailView_',dataContext.id,'" ');//apply custom css to detail
652
661
html.push('style="height:',outterHeight,'px;');//set total height of padding
0 commit comments