Jump to content

How to insert a "select all" tickbox in client area?


Remitur

Recommended Posts

by adding some jQuery to the clientareadomains.tpl template...

 

        <script type="text/javascript">
       function toggle(source) {
           var checkboxes = document.querySelectorAll('input[type="checkbox"]');
           for (var i = 0; i < checkboxes.length; i++) {
               if (checkboxes[i] != source)
                   checkboxes[i].checked = source.checked;
               }
       }
       </script>

and then changing the initial heading column from...

<th width="20"></th>

to...

th width="20"><input type="checkbox" onclick="toggle(this);" /> {$LANG.all}</th>

 

GYdQq4p.png

 

I suppose you could add the jQuery using an action hook instead, but I can't see a way of adding the 'select all' checkbox to the table without editing the template... so you might as well do it all in the template. :idea:

Link to comment
Share on other sites

I put it after the first <script> block and before the beginning of the form...

 

{if $warnings}
   {include file="$template/includes/alert.tpl" type="warning" msg=$warnings textcenter=true}
{/if}
<div class="tab-content">
   <div class="tab-pane fade in active" id="tabOverview">
       {include file="$template/includes/tablelist.tpl" tableName="DomainsList" noSortColumns="0, 6" startOrderCol="1" filterColumn="5"}
       <script type="text/javascript">
           jQuery(document).ready( function ()
           {
               var table = jQuery('#tableDomainsList').removeClass('hidden').DataTable();
               {if $orderby == 'domain'}
                   table.order(1, '{$sort}');
               {elseif $orderby == 'regdate' || $orderby == 'registrationdate'}
                   table.order(2, '{$sort}');
               {elseif $orderby == 'nextduedate'}
                   table.order(3, '{$sort}');
               {elseif $orderby == 'autorenew'}
                   table.order(4, '{$sort}');
               {elseif $orderby == 'status'}
                   table.order(5, '{$sort}');
               {/if}
               table.draw();
               jQuery('#tableLoading').addClass('hidden');
           });
       </script>
       <script type="text/javascript">
       function toggle(source) {
           var checkboxes = document.querySelectorAll('input[type="checkbox"]');
           for (var i = 0; i < checkboxes.length; i++) {
               if (checkboxes[i] != source)
                   checkboxes[i].checked = source.checked;
               }
       }
       </script>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated