21require
'../../../../main.inc.php';
31if ($user->socid > 0) {
36require_once DOL_DOCUMENT_ROOT .
'/admin/tools/ui/class/documentation.class.php';
39$langs->load(
'uxdocumentation');
44$experimentName =
'TableRowIntuitiveSelect';
48 '/includes/ace/src/ace.js',
49 '/includes/ace/src/ext-statusbar.js',
50 '/includes/ace/src/ext-language_tools.js',
57$documentation->docHeader($langs->trans($experimentName, $group), $js, $css);
60$documentation->view = [$group, $experimentName];
63$documentation->showSidebar();
68<div
class=
"doc-wrapper">
70 <?php $documentation->showBreadCrumb(); ?>
72 <div
class=
"doc-content-wrapper">
74 <h1
class=
"documentation-title"><?php echo $langs->trans($experimentName); ?></h1>
76 <?php $documentation->showSummary(); ?>
78 <div
class=
"documentation-section" >
79 <h2
class=
"documentation-title" >Select
table lines by <kbd>Ctrl</kbd> + <kbd>Click</kbd></h2>
84 This feature allows users to <strong>select</strong> or <strong>deselect</strong>
table rows (<code><tr></code>) in an HTML
table:
87 <li>Holding down <strong>Ctrl</strong> (or <strong>Cmd</strong> on Mac) allows users to add or remove individual rows from the selection.</li>
88 <li>Holding down <strong>Shift</strong> allows users to <strong>select a range</strong> of rows between the last selected row and the clicked row.</li>
91 <h2>Detailed Behavior</h2>
92 <
table border=
"1" cellpadding=
"6" cellspacing=
"0">
96 <th>Expected Result</th>
101 <td>Ctrl + Click on a row</td>
102 <td>Toggles selection of the clicked row (add/remove).</td>
105 <td>Shift + Click on a row</td>
106 <td>Selects all rows between the last selected and clicked row.</td>
111 <h2>HTML Requirements</h2>
113 The
table should follow a standard structure with <code><thead></code> and <code><tbody></code> elements,
114 and each <code><tr></code> must be selectable by applying <code>.row-with-select</code> CSS
class and have checkbox with <code>.checkforselect</code> class
119 <li>The script supports <strong>Cmd</strong> key (for Mac users) as an alternative to <strong>Ctrl</strong>.</li>
120 <li>When Shift-clicking without a previously selected row, selection will not start.</li>
121 <li>When
user start selection, the css rules will remove text selection possibility.</li>
122 <li>When the
user double-clicks, the selection functionality is reactivated, but the reference to the last selected row is cleared, thus disabling the <code>Shift + Click</code> range selection behavior.</li>
126 <div class=
"documentation-example">
127 <div
class=
"div-table-responsive">
128 <
table class=
"tagtable liste listwithfilterbefore table-with-select" id=
"try-line-ctrl-click-feature">
130 <tr
class=
"liste_titre_filter">
131 <td
class=
"liste_titre center maxwidthsearch">
132 <div
class=
"nowraponall">
133 <
button type=
"submit" class=
"liste_titre button_search reposition" name=
"button_search_x" value=
"x">
134 <span
class=
"fas fa-search"></span>
136 <
button type=
"submit" class=
"liste_titre button_removefilter reposition" name=
"button_removefilter_x" value=
"x">
137 <span
class=
"fas fa-times"></span>
141 <td><input
class=
"flat" type=
"text" name=
"search_firstname" value=
""></td>
142 <td><input
class=
"flat" type=
"text" name=
"search_lasttname" value=
""></td>
143 <td
class=
"center"><input
class=
"maxwidth50 flat" type=
"text" name=
"search_age" value=
""></td>
144 <td
class=
"right"><input
class=
"flat" type=
"text" name=
"search_country" value=
""></td>
146 <tr
class=
"liste_titre">
148 <dl
class=
"dropdown" style=
"opacity: 0.5;">
149 <dt><span
class=
"fas fa-list" style=
""></span></dt>
150 <dd
class=
"dropdowndd">
151 <div
class=
"multiselectcheckboxselectedfields">
152 <ul
class=
"selectedfieldsleft"></ul>
156 <div
class=
"inline-block checkallactions">
157 <input
type=
"checkbox" id=
"checkforselects" name=
"checkforselects" class=
"checkallactions" >
158 <script nonce=
"<?php echo getNonce(); ?>" >
160 $(document).ready(
function() {
161 $(
"#checkforselects").click(
function() {
162 if($(
this).is(
':checked')){
163 console.log(
"We check all checkforselect and trigger the change method");
164 $(
".checkforselect").prop(
'checked',
true).trigger(
'change');
168 console.log(
"We uncheck all");
169 $(
".checkforselect").prop(
'checked',
false).trigger(
'change');
171 if (typeof initCheckForSelect ==
'function') { initCheckForSelect(0,
"massaction",
"checkforselect"); }
else { console.log(
"No function initCheckForSelect found. Call won't be done."); } });
172 $(
".checkforselect").change(
function() {
174 $(
this).closest(
"tr").toggleClass(
"highlight", this.checked);
180 <th
class=
"wrapcolumntitle left" title=
"First Name">First Name</th>
181 <th
class=
"wrapcolumntitle left" title=
"Last Name">Last Name</th>
182 <th
class=
"wrapcolumntitle center" title=
"Age">Age</th>
183 <th
class=
"wrapcolumntitle right" title=
"Country">Country</th>
187 <tr
class=
"oddeven row-with-select" >
188 <td><input
class=
"checkforselect" type=
"checkbox" name=
"" value=
"" ></td>
189 <td
class=
"left">John</td>
190 <td
class=
"left">Doe</td>
191 <td
class=
"center">37</td>
192 <td
class=
"right">U.S.A</td>
194 <tr
class=
"oddeven row-with-select">
195 <td><input
class=
"checkforselect" type=
"checkbox" name=
"" value=
"" ></td>
196 <td
class=
"left">Jack</td>
197 <td
class=
"left">Sparrow</td>
198 <td
class=
"center">29</td>
199 <td
class=
"right">Caribbean</td>
201 <tr
class=
"oddeven row-with-select">
202 <td><input
class=
"checkforselect" type=
"checkbox" name=
"" value=
"" ></td>
203 <td
class=
"left">Sacha</td>
204 <td
class=
"left">Ketchum</td>
205 <td
class=
"center">16</td>
206 <td
class=
"right">Kanto</td>
208 <tr
class=
"oddeven row-with-select">
209 <td><input
class=
"checkforselect" type=
"checkbox" name=
"" value=
"" ></td>
210 <td
class=
"left">Albert</td>
211 <td
class=
"left">Einstein</td>
212 <td
class=
"center">72</td>
213 <td
class=
"right">Germany</td>
215 <tr
class=
"oddeven row-with-select" >
216 <td><input
class=
"checkforselect" type=
"checkbox" name=
"" value=
"" ></td>
217 <td
class=
"left">John</td>
218 <td
class=
"left">Doe</td>
219 <td
class=
"center">37</td>
220 <td
class=
"right">U.S.A</td>
222 <tr
class=
"oddeven row-with-select">
223 <td><input
class=
"checkforselect" type=
"checkbox" name=
"" value=
"" ></td>
224 <td
class=
"left">Jack</td>
225 <td
class=
"left">Sparrow</td>
226 <td
class=
"center">29</td>
227 <td
class=
"right">Caribbean</td>
229 <tr
class=
"oddeven row-with-select">
230 <td><input
class=
"checkforselect" type=
"checkbox" name=
"" value=
"" ></td>
231 <td
class=
"left">Sacha</td>
232 <td
class=
"left">Ketchum</td>
233 <td
class=
"center">16</td>
234 <td
class=
"right">Kanto</td>
236 <tr
class=
"oddeven row-with-select">
237 <td><input
class=
"checkforselect" type=
"checkbox" name=
"" value=
"" ></td>
238 <td
class=
"left">Albert</td>
239 <td
class=
"left">Einstein</td>
240 <td
class=
"center">72</td>
241 <td
class=
"right">Germany</td>
243 <tr
class=
"oddeven row-with-select" >
244 <td><input
class=
"checkforselect" type=
"checkbox" name=
"" value=
"" ></td>
245 <td
class=
"left">John</td>
246 <td
class=
"left">Doe</td>
247 <td
class=
"center">37</td>
248 <td
class=
"right">U.S.A</td>
250 <tr
class=
"oddeven row-with-select">
251 <td><input
class=
"checkforselect" type=
"checkbox" name=
"" value=
"" ></td>
252 <td
class=
"left">Jack</td>
253 <td
class=
"left">Sparrow</td>
254 <td
class=
"center">29</td>
255 <td
class=
"right">Caribbean</td>
257 <tr
class=
"oddeven row-with-select">
258 <td><input
class=
"checkforselect" type=
"checkbox" name=
"" value=
"" ></td>
259 <td
class=
"left">Sacha</td>
260 <td
class=
"left">Ketchum</td>
261 <td
class=
"center">16</td>
262 <td
class=
"right">Kanto</td>
264 <tr
class=
"oddeven row-with-select">
265 <td><input
class=
"checkforselect" type=
"checkbox" name=
"" value=
"" ></td>
266 <td
class=
"left">Albert</td>
267 <td
class=
"left">Einstein</td>
268 <td
class=
"center">72</td>
269 <td
class=
"right">Germany</td>
271 <tr
class=
"oddeven row-with-select" >
272 <td><input
class=
"checkforselect" type=
"checkbox" name=
"" value=
"" ></td>
273 <td
class=
"left">John</td>
274 <td
class=
"left">Doe</td>
275 <td
class=
"center">37</td>
276 <td
class=
"right">U.S.A</td>
278 <tr
class=
"oddeven row-with-select">
279 <td><input
class=
"checkforselect" type=
"checkbox" name=
"" value=
"" ></td>
280 <td
class=
"left">Jack</td>
281 <td
class=
"left">Sparrow</td>
282 <td
class=
"center">29</td>
283 <td
class=
"right">Caribbean</td>
285 <tr
class=
"oddeven row-with-select">
286 <td><input
class=
"checkforselect" type=
"checkbox" name=
"" value=
"" ></td>
287 <td
class=
"left">Sacha</td>
288 <td
class=
"left">Ketchum</td>
289 <td
class=
"center">16</td>
290 <td
class=
"right">Kanto</td>
292 <tr
class=
"oddeven row-with-select">
293 <td><input
class=
"checkforselect" type=
"checkbox" name=
"" value=
"" ></td>
294 <td
class=
"left">Albert</td>
295 <td
class=
"left">Einstein</td>
296 <td
class=
"center">72</td>
297 <td
class=
"right">Germany</td>
314$documentation->docFooter();
Class to manage UI documentation.
Class to manage Dolibarr users.
multi select button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
treeview li table
No Email.
$conf db user
Active Directory does not allow anonymous connections.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
$conf db name
Only used if Module[ID]Name translation string is not found.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.