Comments

attiks’s picture

Status: Active » Needs review
StatusFileSize
new4.46 KB
attiks’s picture

StatusFileSize
new5.51 KB

newer patch

jonloh’s picture

Awesome patch attiks! Unfortunately your patch doesn't seem to go well with the latest 7.x-1.x-dev. I've attached a new patch for this.

Hopefully the author of this module will be able to commit this in, as this could be a necessary feature to have :)

retiredpro’s picture

I applied this patch against the dev release. I then went into my field collection field's settings and checked the box for Disable drag and drop. Doesn't work for me though. I even tried changing from Table to Embedded, save, and then back. Also tried creating a new node but I can always rearrange.

No error messages though. If it matters, im on Drupal 7.15 and the latest dev release of the field collections module (8/9/2012) with patch from http://drupal.org/node/1239946#comment-6325230

mstrelan’s picture

+1 for this feature. Haven't tried the patches, but really need it to save space on a really wide table I've got.

attiks’s picture

Priority: Normal » Major
StatusFileSize
new5.31 KB

New patch

imclean’s picture

Priority: Major » Normal
StatusFileSize
new5.64 KB

Patch in #6 didn't apply to version in git.

Updated with some minor code changes. This works as expected, however sometimes the table headers disappear when clicking "Add more". They reappear after clicking the button at least once more.

welly’s picture

Having the same problem with the draggable table disable as #4. Using Field Collection beta5+1-dev and Field Collection Table beta 1. The checkbox is showing when I use the patch in #7 but my tables are still draggable. I've cleared cache a number of times.

imclean’s picture

Make sure you're using the latest dev of field_collection.

Apply patch in #7 to the git version of field_collection_table, as I suggested. It *might* work with the dev version from the project page, but don't use the beta version.

imclean’s picture

Clicking "Remove" on some rows can reorder them. To test, enter some data in the first row, click "Add another item" a few times then remove one of the empty rows.

nikathone’s picture

Issue summary: View changes

Using latest dev of field_collection_table along with patch on #7 did the trick for me. Thanks

pebosi’s picture

Patch #7 is still working with dev Version, please review / commit.

kevineinarsson’s picture

Status: Needs review » Fixed

Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

stephenrobinson’s picture

use this for normal fields

/**
 * Implements hook_field_widget_form_alter().
 */
function mymodule_field_widget_form_alter(&$element, &$form_state, $context) {
  $disabledragid='';
  $fieldnames=array('field_timeline'); // add more fields here...........
  if(isset($element['#field_name'])){
    if( in_array($element['#field_name'], array_values($fieldnames)) ){
      if(isset($element['_weight'])){
        $element['_weight']['#access']=false;
        $disabledragid='.field-type'.str_replace('field_','-',$element['#field_name'].'-field');
      }
    }
  }
  if($disabledragid!=''){
    drupal_add_js("
(function ($) { 
  var hideColumns = Drupal.tableDrag.prototype.hideColumns;
  Drupal.tableDrag.prototype.hideColumns = function() {
    hideColumns.call(this);
    $('".$disabledragid." .tabledrag-toggle-weight').text('');
    $('".$disabledragid." .field-multiple-drag').text('');
    $('".$disabledragid." th:last').text('');
  }
  var showColumns = Drupal.tableDrag.prototype.showColumns;
  Drupal.tableDrag.prototype.showColumns = function () {
    showColumns.call(this);
    $('".$disabledragid." .tabledrag-toggle-weight').text('');
    $('".$disabledragid." .field-multiple-drag').text('');
    $('".$disabledragid." th:last').text('');
  }
})(jQuery);
", 'inline');
  }
}