質問編集履歴

2

記述ミス

2018/08/03 23:01

投稿

tky31
tky31

スコア17

test CHANGED
File without changes
test CHANGED
@@ -312,6 +312,6 @@
312
312
 
313
313
 
314
314
 
315
- Chromeのデバック調べるとエラーが見られました
315
+ Chromeで確認してもエラー等はないです。
316
-
316
+
317
- ![イメージ説明](5e50f474bdfd0daa32de8b9a23ecd7c5.png)
317
+ ![イメージ説明](99cc55606c95b5015a18e23bc8ca7664.png)

1

コードの追加

2018/08/03 23:01

投稿

tky31
tky31

スコア17

test CHANGED
File without changes
test CHANGED
@@ -195,3 +195,123 @@
195
195
  情報不十分ですが、何か情報あれば教えてください。
196
196
 
197
197
  よろしくおねがいいたします
198
+
199
+
200
+
201
+
202
+
203
+ <追記>
204
+
205
+ 実際のViewのコードです
206
+
207
+ ```
208
+
209
+ <script>
210
+
211
+ $(document).ready(function() {
212
+
213
+ $('#students').DataTable( {
214
+
215
+ dom: 'Bfrtip',
216
+
217
+ buttons: [
218
+
219
+ {
220
+
221
+ extend: 'colvisGroup',
222
+
223
+ text: 'Office info',
224
+
225
+ show: [ 1, 2 ],
226
+
227
+ hide: [ 3, 4, 5 ]
228
+
229
+ },
230
+
231
+ {
232
+
233
+ extend: 'colvisGroup',
234
+
235
+ text: 'HR info',
236
+
237
+ show: [ 3, 4, 5 ],
238
+
239
+ hide: [ 1, 2 ]
240
+
241
+ },
242
+
243
+ {
244
+
245
+ extend: 'colvisGroup',
246
+
247
+ text: 'Show all',
248
+
249
+ show: ':hidden'
250
+
251
+ }
252
+
253
+ ]
254
+
255
+ } );
256
+
257
+ } );
258
+
259
+ </script>
260
+
261
+
262
+
263
+ <!-- DataTablesのデータ -->
264
+
265
+ <h3>DataTablesを使ってみる</h3>
266
+
267
+ <table id="students">
268
+
269
+ <thead>
270
+
271
+ <tr>
272
+
273
+ <th>Student Name</th>
274
+
275
+ <th>Student Sex</th>
276
+
277
+ <th>Student Age</th>
278
+
279
+ </tr>
280
+
281
+ </thead>
282
+
283
+ <tbody>
284
+
285
+ <% @students.each do |student| %>
286
+
287
+ <tr>
288
+
289
+ <td><%= link_to(student.name, student)%></td>
290
+
291
+ <td><%= student.sex %></td>
292
+
293
+ <td><%= student.age %></td>
294
+
295
+ </tr>
296
+
297
+ <% end %>
298
+
299
+ </tbody>
300
+
301
+ </table>
302
+
303
+ ```
304
+
305
+ このコードでDataTablesのサンプルの様にボタンが表示してほしいのだが、表示されません。。。
306
+
307
+ ![イメージ説明](cd3a70632bc279762fc17b1c193587ef.png)
308
+
309
+
310
+
311
+ ボタンのみ、Jqueryが動作していないのでしょうか?
312
+
313
+
314
+
315
+ ※Chromeのデバックで調べるとエラーが見られました
316
+
317
+ ![イメージ説明](5e50f474bdfd0daa32de8b9a23ecd7c5.png)