質問編集履歴
3
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,6 +28,8 @@
|
|
28
28
|
|
29
29
|
```update.js.erb
|
30
30
|
|
31
|
+
# update.js.erb
|
32
|
+
|
31
33
|
$("#admin-position-modal-form").modal("hide");
|
32
34
|
|
33
35
|
$("tr[data-position-id=<%= @position.id %>]").html("<%= j(render @position) %>");
|
@@ -37,6 +39,8 @@
|
|
37
39
|
|
38
40
|
|
39
41
|
```_position.html.slim
|
42
|
+
|
43
|
+
# _position.html.slim
|
40
44
|
|
41
45
|
tr
|
42
46
|
|
2
修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
update.js.erbからtableのtr要素をまるごと書き換えたい
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
更新するタイミングでtrを変更したいです。
|
2
2
|
|
3
3
|
``.html``で行うと、``tr``の中に``tr``が作られてしまい、レイアウトが崩れてしまいます。
|
4
4
|
|
@@ -26,8 +26,38 @@
|
|
26
26
|
|
27
27
|
|
28
28
|
|
29
|
-
```j
|
29
|
+
```update.js.erb
|
30
30
|
|
31
|
+
$("#admin-position-modal-form").modal("hide");
|
32
|
+
|
31
|
-
$("tr[data-
|
33
|
+
$("tr[data-position-id=<%= @position.id %>]").html("<%= j(render @position) %>");
|
32
34
|
|
33
35
|
```
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
```_position.html.slim
|
40
|
+
|
41
|
+
tr
|
42
|
+
|
43
|
+
td
|
44
|
+
|
45
|
+
= link_to position.name, edit_position_path(position), remote: true
|
46
|
+
|
47
|
+
td
|
48
|
+
|
49
|
+
= l(position.created_at)
|
50
|
+
|
51
|
+
td
|
52
|
+
|
53
|
+
= l(position.updated_at)
|
54
|
+
|
55
|
+
td
|
56
|
+
|
57
|
+
= position.creator.full_name
|
58
|
+
|
59
|
+
td
|
60
|
+
|
61
|
+
= position.updater&.full_name
|
62
|
+
|
63
|
+
```
|
1
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,6 +28,6 @@
|
|
28
28
|
|
29
29
|
```javascript
|
30
30
|
|
31
|
-
$("tr[data-hoge-id=2]").html("<tr><td>内容を変更</td></tr>");
|
31
|
+
$("tr[data-hoge-id=2]").html("<tr data-hoge-id=2><td>内容を変更</td></tr>");
|
32
32
|
|
33
33
|
```
|