どうも中田です。
今日は情けないブログを書きます。
angularJSでdatatableを使いたい!
ってことで、angular-datatablesを使うことになりました。
http://l-lin.github.io/angular-datatables/#/gettingStarted
大変便利なんですが、行削除や行編集をした後クリックが効かない問題が発生しました。
画面更新したらできるようになるんですが、なんでだろうな〜って悩んでたら
原因はこれです。
原因
datatablesプロパティの設定ミス!
本当に情けないブログですが、
もし、、もし困っている人がいたらと思いまして。。(いないか)
問題となった書き方
<table id="dataTables" datatable dt-options="dtOptions" dt-column-defs="dtColumnDefs"> <thead> <tr> <th class="col-sm-10">column1</th> <th class="col-sm-2">column2</th> </tr> </thead> (略)
正しい書き方
<table id="dataTables" datatable="ng" dt-options="dtOptions" dt-column-defs="dtColumnDefs"> <thead> <tr> <th class="col-sm-10">column1</th> <th class="col-sm-2">column2</th> </tr> </thead> (略)
間違い探しみたいですが、要はdatatables=”ng”というプロパティの設定が必要でしたよという話。
Don’t forget to set the properties ng in the directive datatable in order to tell the directive to use the Angular way!
訳:角度の方法を使用するように指示を伝えるためにディレクティブのDataTableのngのプロパティを設定することを忘れないでください!
…..とにかくngプロパティを忘れるなと強く書いてあるのに、しっかりちゃっかり忘れてました。
誰に謝ってるか分かりませんが、なんかすいません。
感謝サイト
もちろん公式ページ