Missing Database Tableエラー
Table mychuno_users for model MyChunoUser was not found in datasource default.
CakePHP2.3.2ではModelにuseTableを明記しなくても発生しなかったが、2.5.5では明記しないとエラーが発生した。
ということで、useTableを追記。
<?php class MyChuno extends … … … $useTable = 'mychuno_users'; … …
position:relativeやabsolute関連
事象
- 親要素の高さが足りず、子要素がはみ出たり、重なってしまう
- 親要素をheight:100%にしても効かない
対応方法
親要素で、
&>*{ position:absolute; }
となっていたのを、
&>*{ position:relative; }
に変更し、子要素のうち最小限度のものにだけ、
{ position:absolute; }
を設定。
…スッキリしないが一応解決。
AUTO_INCREMENTの確認と設定
AUTO_INCREMENTで次に振られる値を確認する
SHOW TABLE STATUS LIKE 'テーブル名'; # シングルクォートが必要
SHOW TABLE STATUS LIKE 'mychuno_reports';
AUTO_INCREMENTで次に振られる値を設定する
SHOW TABLE STATUS テーブル名 AUTO_INCREMENT = 値;
# シングルクォートは不要
SHOW TABLE STATUS mychuno_reports AUTO_INCREMENT = 99;
jQueryあれこれ
親兄弟子要素への操作
HTML
<table> <tr class="mychuno-list"> <td> …… <!-- HTML5 カスタムデータ属性「data-*」を用いる --> <input type="button" id="btn-display" value="開く" data-is-open="0"> </td> </tr> <tr class="mychuno-detail" > <td> …… </td> </tr> </table>
Javascript(jQuery)
jQuery(function(){ $('.btn-display').click(function(e){ // HTML5 カスタムデータ属性「data-*」を取得する if($(this).data('is-open') === 0){ var $this_chuno = $(this); $this_chuno.parents('.mychuno-list').next('.mychuno-detail').fadeIn('fast', function() { $this_chuno.data('is-open', 1); // ボタンの表示名を書き換える(要素のvalueを変更) $this_chuno.val('閉じる'); }); }else if($(this).data('is-open') === 1){ var $this_chuno = $(this); $this_chuno.parents('.mychuno-list').next('.mychuno-detail').fadeOut('fast', function() { $this_chuno.data('is-open', 0); // ボタンの表示名を書き換える(要素のvalueを変更) $this_chuno.val('開く'); }); } }); });