てきとう

ワーワーゆうとります

tabledragとdatepickerの狭間でゆれうごいたよー!

前提


CCKモジュールを使ってコンテンツタイプを作成中、dateのフィールドを追加してみたところ、datepickerが動きませんでした。
出たエラーを見ると、a.delegate is not a functionとかなんとか。それはそうです。だってdelegateは1.4.2以上から。
じゃあ、と思ってjquery_updateの中のjquery(/sites/all/modules/jquery_update/replace/jquery.min.js)を1.3.2から1.4.2にこっそりアップデート


1.4.2になったのでdatepickerがさくさく動くよ!と安心してフィールド追加に戻ったっけ、今度はフィールド管理にエラー。
エラーというか、フィールドのソートも、フィールド追加のセレクトボックス連動も動かない!うんともすんとも!
泣きたい気持ちでしたが世の中にはかっこいい人がいるね。
Tabledrag.js and jQuery 1.4.2 (http://drupal.org/node/893538

これに倣って、/var/www/shufu/sites/all/modules/jquery_update/replace/tabledrag.jsを変更
169行目から。

  // Create the handle.
  var handle = $('<a href="#" class="tabledrag-handle"><div class="handle">&nbsp;</div></a>').attr('title', Drupal.t('Drag to re-order'));
  // Insert the handle after indentations (if any).
  if ($('td:first .indentation:last', item).after(handle).size()) {
    // Update the total width of indentation in this entire table.
    self.indentCount = Math.max($('.indentation', item).size(), self.indentCount);
  }
  else {
    $('td:first', item).prepend(handle);
  }

これを

  // Create the handle.
  var handle = $('<a href="#" class="tabledrag-handle"><div class="handle">&nbsp;</div></a>').attr('title', Drupal.t('Drag to re-order'));
  // Insert the handle after indentations (if any).
    if ($('td:first .indentation:last', item).length) {
    // Update the total width of indentation in this entire table.
    $('td:first .indentation:last', item).after(handle);
    self.indentCount = Math.max($('.indentation', item).size(), self.indentCount);
  }
  else {
    $('td:first', item).prepend(handle);
  }

こう。
お陰でつつがなく動作致しました。ありがとう、外国の方。awesomeだよ。