Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> jquery datatables, edycja tabeli
Tomasz7755
post 13.07.2016, 21:51:42
Post #1





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 10.07.2016

Ostrzeżenie: (0%)
-----


czesc

Chcialbym przelozyc przyklad z tego linka: https://editor.datatables.net/examples/simple/multiRow.html

Jednak chcialbym aby dane byly pobierane z tabeli HTML, nie z ajaxa.
Dostaje niestety komunikat: TypeError: $.fn.dataTable.Editor is not a constructor

Moj kod :

  1. <!DOCTYPE html>
  2.  
  3.  
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.  
  7. <link rel="stylesheet" href="css/jquery.dataTables.min.css" >
  8. <link rel="stylesheet" href="css/buttons.dataTables.min.css" >
  9. <link rel="stylesheet" href="css/select.dataTables.min.css" >
  10. <link rel="stylesheet" href="css/editor.dataTables.min.css" >
  11.  
  12. <script src="js/jquery.js"></script>
  13. <script src="js/jquery.dataTables.min.js"></script>
  14. <script src="js/dataTables.buttons.min.js"></script>
  15. <script src="js/dataTables.select.min.js"></script>
  16. <script src="js/dataTables.editor.min.js"></script>
  17.  
  18. var editor; // use a global for the submit and return data rendering in the examples
  19.  
  20. $(document).ready(function() {
  21. editor = new $.fn.dataTable.Editor( {
  22. table: "#example",
  23. fields: [ {
  24. label: "First name:",
  25. name: "first_name"
  26. }, {
  27. label: "Last name:",
  28. name: "last_name"
  29. }, {
  30. label: "Position:",
  31. name: "position"
  32. }, {
  33. label: "Office:",
  34. name: "office"
  35. }, {
  36. label: "Extension:",
  37. name: "extn"
  38. }, {
  39. label: "Start date:",
  40. name: "start_date",
  41. type: "datetime"
  42. }, {
  43. label: "Salary:",
  44. name: "salary"
  45. }
  46. ]
  47. } );
  48.  
  49. $('#example').DataTable( {
  50.  
  51. select: true,
  52. buttons: [
  53. { extend: "create", editor: editor },
  54. { extend: "edit", editor: editor },
  55. { extend: "remove", editor: editor }
  56. ]
  57. } );
  58. } );
  59. </script>
  60. </head>
  61. <table id="example" class="display" cellspacing="0" width="100%">
  62. <tr>
  63. <th>Name</th>
  64. <th>Position</th>
  65. <th>Office</th>
  66. <th>Extn.</th>
  67. <th>Start date</th>
  68. <th>Salary</th>
  69. </tr>
  70. </thead>
  71. <tr>
  72. <th>Name</th>
  73. <th>Position</th>
  74. <th>Office</th>
  75. <th>Extn.</th>
  76. <th>Start date</th>
  77. <th>Salary</th>
  78. </tr>
  79. </tfoot>
  80. <tr>
  81. <td>Airi Satou</td>
  82. <td>Accountant</td>
  83. <td>Tokyo</td>
  84. <td>5407</td>
  85. <td>2008-11-28</td>
  86. <td>$162,700</td>
  87. </tr>
  88. <tr>
  89. <td>Brenden Wagner</td>
  90. <td>Software Engineer</td>
  91. <td>San Francisco</td>
  92. <td>1314</td>
  93. <td>2011-06-07</td>
  94. <td>$206,850</td>
  95. </tr>
  96. <tr>
  97. <td>Brielle Williamson</td>
  98. <td>Integration Specialist</td>
  99. <td>New York</td><td>4804</td>
  100. <td>2012-12-02</td>
  101. <td>$372,000</td>
  102. </tr>
  103. </tbody>
  104. </body>


Moze wiecie gdzie lezy przyczyna bledu? smile.gif

Ten post edytował Tomasz7755 13.07.2016, 21:52:49
Go to the top of the page
+Quote Post
emstawicki
post 14.07.2016, 07:11:19
Post #2





Grupa: Zarejestrowani
Postów: 207
Pomógł: 40
Dołączył: 2.06.2016
Skąd: Olsztyn

Ostrzeżenie: (0%)
-----


Może od rzeczy prostej. Upewniłeś się czy wszystkie pliki js wczytują się prawidłowo?


--------------------
Jak w Olsztynie, to tylko w Revolver Rock Cafe .
Sprawdź postęp propagacji DNS
Go to the top of the page
+Quote Post
Tomasz7755
post 14.07.2016, 16:52:26
Post #3





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 10.07.2016

Ostrzeżenie: (0%)
-----


Jasne, zarowno pliki js jak i css sa wczytywane tak jak trzeba. Sprawdzilem to otwierajac zrodlo strony i klikajac na kazdy po kolei.

Znalazlem inny przyklad, taki ktory potrzebuje, skopiowalem wszystko identycznie jak jest na stronie jednak dalej mi wyrzuca ze "$.fn.dataTable.Editor is not a constructor"

Link do przykladu : https://editor.datatables.net/examples/adva.../htmlTable.html

Moze ktos z was sprawdzi i ogarnie co jest nie tak ?:-)
Go to the top of the page
+Quote Post
trueblue
post 14.07.2016, 17:07:40
Post #4





Grupa: Zarejestrowani
Postów: 6 806
Pomógł: 1828
Dołączył: 11.03.2014

Ostrzeżenie: (0%)
-----


Nic innego (inny błąd) w konsoli się nie wyświetla?

Ten post edytował trueblue 14.07.2016, 17:07:53


--------------------
Go to the top of the page
+Quote Post
Tomasz7755
post 14.07.2016, 17:25:36
Post #5





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 10.07.2016

Ostrzeżenie: (0%)
-----


Dostaje jeszcze informacje o tym, zeby nie kopiowac tego pliku na lokalny dysk:
uncaught exception: DataTables Editor - remote hosting of code not allowed. Please see http://editor.datatables.net for details on how to purchase an Editor license

Wiec zmienilem sciezke z mojego dysku na link do strony datatables: https://editor.datatables.net/extensions/Ed...s.editor.min.js

jednak dalej jest to samo
Go to the top of the page
+Quote Post
trueblue
post 14.07.2016, 17:44:59
Post #6





Grupa: Zarejestrowani
Postów: 6 806
Pomógł: 1828
Dołączył: 11.03.2014

Ostrzeżenie: (0%)
-----


https://datatables.net/forums/discussion/34...r#Comment_92490


--------------------
Go to the top of the page
+Quote Post
Tomasz7755
post 14.07.2016, 17:54:54
Post #7





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 10.07.2016

Ostrzeżenie: (0%)
-----


dzieki, czyli widze ze trzeba pobrac ten plik z wersja trial. Tylko nigdzie ,nie widze informacji o cenie po okresie 15 dni, wiesz moze gdzie ona sie znajduje ?smile.gif
Go to the top of the page
+Quote Post
trueblue
post 14.07.2016, 17:59:12
Post #8





Grupa: Zarejestrowani
Postów: 6 806
Pomógł: 1828
Dołączył: 11.03.2014

Ostrzeżenie: (0%)
-----


https://editor.datatables.net/purchase/


--------------------
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 13.08.2025 - 22:32