ColumnSelector: Add columnSelector_maxPriorities. Fixes #1204

This commit is contained in:
Rob Garrison 2016-04-29 21:08:29 -05:00
parent e9b87a9a07
commit a7e002f87b
3 changed files with 34 additions and 5 deletions

View File

@ -175,6 +175,12 @@
<h3><a href="#">Notes</a></h3>
<div>
<ul>
<li>In <span class="version">v2.25.9</span>,
<ul>
<li>Added a <code>columnSelector_maxPriorities</code> setting.</li>
<li>Using the "refreshColumnSelector" method now properly saves the settings if the <code>columnSelector_saveColumns</code> is <code>true</code>.</li>
<li>The widget still uses the <code>filter_filteredRow</code> setting, but now falls back to using "filtered" when it is undefined.</li>
</ul>
<li>In <span class="version">v2.24.0</span>,
<ul>
<li>This widget now supports extra rows and <code>colspan</code> cells in the header &amp; footer (not the body). The first demo has been updated to show this enhancement.</li>
@ -380,14 +386,34 @@
<div class="collapsible">
<br>
<ul>
<li>For example, the last entry &quot;70em&quot; (1,120px) is assigned to data-priority 6. When the browser width is below this dimension, all columns with a data-priority of six will be hidden. Then when a browser width less than &quot;60em&quot; (960px) is reached, all columns of data-priority 5 and above will be hidden. At &quot;50em&quot; (800px), all columns of data-priority 4 and above are hidden, etc.</li>
<li>Adjust these values as desired, but a <em>maximum</em> of six data-priorities is set.</li>
<li>For example,
<ul>
<li>The last entry &quot;70em&quot; (1,120px) is assigned to data-priority 6.</li>
<li>When the browser width is below this dimension, all columns with a data-priority of six will be hidden.</li>
<li>Then when a browser width less than &quot;60em&quot; (960px) is reached, all columns of data-priority 5 and above will be hidden.</li>
<li>At &quot;50em&quot; (800px), all columns of data-priority 4 and above are hidden, etc.</li>
</ul>
<br>
</li>
<li>Adjust these values as desired, but a <em>maximum</em> number data-priorities is set by the <code>columnSelector_maxPriorities</code> value (<span class="version updated">v2.25.9</span>).</li>
</ul>
Default value: <code>[ &quot;20em&quot;, &quot;30em&quot;, &quot;40em&quot;, &quot;50em&quot;, &quot;60em&quot;, &quot;70em&quot; ]</code>
</div>
</td>
</tr>
<tr id="column-selector-maxpriority">
<td><a href="#" class="permalink">columnSelector_maxPriorities</a></td>
<td>This option sets the maximum number of priorities (<span class="version">v2.25.9</span>).
<div class="collapsible">
<br>
<ul>
<li>If for some reason you need to change the number of priorities (especially increase the number), then change this setting to reflect the maximum number of available priorities.</li>
<li>Then make sure to modify the <code>columnSelector_breakpoints</code> to match this new value.</li>
</ul>
Default value: <code>6</code>
</div>
</td>
</tr>
<tr id="column-selector-priority">
<td><a href="#" class="permalink">columnSelector_priority</a></td>
<td>

View File

@ -455,7 +455,7 @@
<li><span class="label label-info">Beta</span> <a href="example-widget-chart.html">Chart Widget</a> (<span class="version">v2.19.0</span>; <span class="version updated">v2.24.0</span>).</li>
<li><span class="results">&dagger;</span> <a href="example-widget-columns.html">Columns highlight widget</a> (v2.0.17).</li>
<li><a href="example-widget-column-selector.html">Column selector widget</a> (<span class="version">v2.15</span>; <span class="version updated">v2.25.1</span>).</li>
<li><a href="example-widget-column-selector.html">Column selector widget</a> (<span class="version">v2.15</span>; <span class="version updated">v2.25.9</span>).</li>
<li><a href="example-widget-editable.html">Content editable widget</a> (v2.9; <span class="version updated">v2.25.5</span>).</li>
<li><span class="label label-info">Beta</span> <a href="example-dragtable.html">Dragtable mod</a> - (jQuery UI widget for column reordering [<a class="external" href="http://stackoverflow.com/a/27770224/145346">ref</a>]; <span class="version">v2.24.0</span>).</li>
<li><span class="results">&dagger;</span> Filter widget (<span class="version updated">v2.25.7</span>):

View File

@ -273,7 +273,7 @@
}
}
// only 6 breakpoints (same as jQuery Mobile)
for (priority = 0; priority < 6; priority++){
for (priority = 0; priority < wo.columnSelector_maxPriorities; priority++){
/*jshint loopfunc:true */
breaks = [];
c.$headers.filter('[' + wo.columnSelector_priority + '=' + (priority + 1) + ']').each(function(){
@ -471,6 +471,9 @@
// see http://view.jquerymobile.com/1.3.2/dist/demos/widgets/table-column-toggle/#Applyingapresetbreakpoint
// *** set to false to disable ***
columnSelector_breakpoints : [ '20em', '30em', '40em', '50em', '60em', '70em' ],
// maximum number of priority settings; if this value is changed (especially increased),
// then make sure to modify the columnSelector_breakpoints - see #1204
columnSelector_maxPriorities : 6,
// data attribute containing column priority
// duplicates how jQuery mobile uses priorities:
// http://view.jquerymobile.com/1.3.2/dist/demos/widgets/table-column-toggle/