Buy One Domain Name, Get One Free

Looking for a reliable and affordable Domain Name Registrar? Look no further than Dotster. And for a limited time, we're able to offer our visitors a buy one domain name, get one free promotion. Click here to take advantage of this offer.

Reliable Hosting With the Best Customer Support

Looking for a dedicated hosting solution with 24/7/365 U.S.-based, English speaking phone support? Visit Rackspace for a reliable, managed hosting solution that will let you focus on the bottom line - your business, while they make sure your website stays online.



Feb 20 2009

Drupal - select all checkbox for tables


Filed under: Content Management Systems » Drupal,
Tools:

Tired of selecting one checkbox at a time?

Depending on the version of Drupal you're running, you may be running into the problem that your tables don't supply a select all or check all checkbox. This is particularly frustrating if you're dealing with a table that has dozens, if not hundreds, of items. One example of a module where the absense of a select all checkbox is particularly frustrating is image import.

Using select all with image import

If you mass import images using Drupal's image import module (via FTP), you'll be presented with a large list of filenames, each with a checkbox. You can check the box next to the image you want to import, and then select a gallery to import them into at the bottom of the page. It saves a ton of time if you can select all the checkboxes at once. How to do this?

You need the 1.x jquery version installed

If you're using the jquery update module, this may be what's causing your problem. If you look at the source code of the page that contains the table you wish to have a select all box available for, you'll notice that in some cases, as with image import, the select all box is being called:

<script type="text/javascript">
Drupal.extend({..."tableSelect": { "selectAll": "Select all rows in this table",...

The problem is that the newer version of jquery update overrides this javascript, so the select all box never gets created. To rectify this problem, uninstall the current version of jquery update you're using, and then reinstall version 5.x-1.0 (delete the module folder and re-upload the old one). If you're using Drupal 6.x, you shouldn't be be experiencing this problem to begin with. If you are, please post below.

You'll also need to copy the jquery.js file from the jquery_update module folder to your root /misc directory, to override the native jquery.js file included with Drupal.

This should fix the problem, and return the select all checkbox to your image import table,  unless you've also got lightbox2 installed, in which case you'll need to make sure you're using the correct version of this module as well.

You need the 1.x lightbox2 version installed

If you're using the lightbox2 module, you'll need to make sure you've got the 5.x-1.1 branch installed (and not a newer one, such as 5.x-2.x). If you have a newer one, make sure you uninstall the old version before reinstalling the new one.

This should effectively solve your problem and return the select all checkbox to your image import table.

Select all checkboxes for all pages

If you're looking to have a select all checkbox available for all your Drupal pages, we encourage you to check out the Checkall module. It will let you set check all (select all) checkboxes for all tables on your site. Note that this is a core functionality supported in Drupal 6.x, but only for tables. You can use this module to add a select all option to all forms on your website.

Average: 4.3 (3 votes)
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Textual smileys will be replaced with graphical ones.

More information about formatting options

CAPTCHA
This question is used to make sure you are a human visitor and to prevent spam submissions.