0
필자는 레일 앱의 일부분에 테이블을 가지고 있으며, DataTables를 사용하여 멋지게 보이고 싶습니다. jquery-datatables-rails
보석을 사용하고 있습니다.내 레일에서 DataTable이 부분적으로 작동하지 않는 이유는 무엇입니까?
내 부분 :
<script type="text/javascript">
$(document).ready(function() {
$('#businesses').dataTable();
});
</script>
<table id="businesses">
<thead>
<tr>
Bunch of headers here...
</tr>
</thead>
<tbody>
<tr>
Lots and lots of code here...
</tr>
</tbody>
</table>
application.js :
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require dataTables/jquery.dataTables
//= require_tree .
application.css :
*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require dataTables/jquery.dataTables
*= require_tree .
*/
DataTables 파일뿐만 아니라 application.js
과 application.css
제대로 참조됩니다.
감사합니다.
은 당신이 의 내부에만 사용하고 있는지 확인. 자바 스크립트 콘솔 (크롬의 f12)에서 오류를 찾으십시오. –
Pheonix
+0
만 사용하고 있습니다. 디버깅 팁을 주셔서 감사합니다. 오류는'$ ("# businesses")입니다. dataTable은 함수가 아닙니다. "... –
Slicekick
+0
A
0
관련 문제
-
1. JSF tomahawk dataTable이 표시되지 않는 이유는 무엇입니까?
-
2. Slice와 Rails 3.2에서 부분적으로 작동하지 않는 이유는 무엇입니까?
-
3. 내 DataTable이 내 DataSet에 일시적으로 추가되는 이유는 무엇입니까?
-
4. 내 버튼의 기능이 작동하지 않는 이유는 무엇입니까?
-
5. 내 쿼리가 작동하지 않는 이유는 무엇입니까?
-
6. 내 JPQL이 작동하지 않는 이유는 무엇입니까?
-
7. 내 paintComponent가 작동하지 않는 이유는 무엇입니까?
-
8. 내 게시물 아약스가 작동하지 않는 이유는 무엇입니까?
-
9. 내 NHibernate 업데이트가 작동하지 않는 이유는 무엇입니까?
-
10. 내 쿼리가 제대로 작동하지 않는 이유는 무엇입니까?
-
11. 내 확장 문이 작동하지 않는 이유는 무엇입니까?
-
12. 내 이미지가 작동하지 않는 이유는 무엇입니까?
-
13. 내 UIPasteboard 코드가 작동하지 않는 이유는 무엇입니까?
-
14. 내 CSS 스프라이트가 작동하지 않는 이유는 무엇입니까?
-
15. 내 viewpager가 단편에서 작동하지 않는 이유는 무엇입니까?
-
16. 내 청취자가 extjs에서 작동하지 않는 이유는 무엇입니까?
-
17. 내 XSLTProcessor transformToDocument가 작동하지 않는 이유는 무엇입니까?
-
18. 내 jspSmartUpload 코드가 작동하지 않는 이유는 무엇입니까?
-
19. 내 RangeValidator가 작동하지 않는 이유는 무엇입니까?
-
20. 내 SimpleOnGestureListener가 작동하지 않는 이유는 무엇입니까?
-
21. 내 JavaScript가 IE에서 작동하지 않는 이유는 무엇입니까?
-
22. 내 ReportViewer가 작동하지 않는 이유는 무엇입니까?
-
23. 내 경로가 예상대로 작동하지 않는 이유는 무엇입니까?
-
24. 내 jQuery Mobile이 작동하지 않는 이유는 무엇입니까?
-
25. 내 메일 양식이 작동하지 않는 이유는 무엇입니까?
-
26. 내 UIButton이 작동하지 않는 이유는 무엇입니까?
-
27. 내 sprintf가 matlab에서 작동하지 않는 이유는 무엇입니까?
-
28. 내 양식이 작동하지 않는 이유는 무엇입니까?
-
29. 내 자바 스크립트가 작동하지 않는 이유는 무엇입니까?
-
30. 내 DropDownList의 SelectedItem이 작동하지 않는 이유는 무엇입니까?
최근 질문
-
1. React 요소 클릭 시뮬레이션
-
2. PartMap의 Retrofit 및 WebKitFormBoundary로 서버에 파일 보내기
-
3. 신경망 손실이 감소하지만 정확도가 증가하지 않을 때?
-
4. Xamarin.Forms와 함께 .alert에 FormattedText를 포함시킬 수있는 방법이 있습니까?
-
5. Ionic-3 이미지 FileTransfer Native에서 NodeJs 서버로
-
6. 자바 FX fxml의 콤보 오류
-
7. 파생 클래스는 다른 파생 클래스의 개인 멤버를 볼 수 있습니까?
-
8. Gamemaker Studio 2에서 플랫폼에서 HTML5인지 여부를 코드에서 어떻게 확인할 수 있습니까?
-
9. 로그인하지 않은 사용자의 페이지 (게시물)에 대한보기로 값을 저장 하시겠습니까?
-
10. 원격 액세스 내가 로컬 네트워크의 예에 원격 장치에서 워드 프레스 웹 사이트에 액세스 할 때 URL
-
1. JSF tomahawk dataTable이 표시되지 않는 이유는 무엇입니까?
-
2. Slice와 Rails 3.2에서 부분적으로 작동하지 않는 이유는 무엇입니까?
-
3. 내 DataTable이 내 DataSet에 일시적으로 추가되는 이유는 무엇입니까?
-
4. 내 버튼의 기능이 작동하지 않는 이유는 무엇입니까?
-
5. 내 쿼리가 작동하지 않는 이유는 무엇입니까?
-
6. 내 JPQL이 작동하지 않는 이유는 무엇입니까?
-
7. 내 paintComponent가 작동하지 않는 이유는 무엇입니까?
-
8. 내 게시물 아약스가 작동하지 않는 이유는 무엇입니까?
-
9. 내 NHibernate 업데이트가 작동하지 않는 이유는 무엇입니까?
-
10. 내 쿼리가 제대로 작동하지 않는 이유는 무엇입니까?
명시된대로
브라우저는이 페이지에서 datatable.js 파일을 찾을 수 없습니다. 관련 코드 application.js를 여기에 추가하십시오. – Pheonix
답변
js 코드를 application.js 파일로 옮겨야합니다.
그래서, 당신의 html.erb 내부에 스크립트 태그는, 당신이 그와 같은 application.js이 있어야 자바 스크립트 부분을 할 없습니다 :
출처
2015-01-01 21:57:58 user3299737
관련 문제