Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# HTML code for editable table
html_table1 <- HTML("<script type='text/javascript'>
/*<![CDATA[*/
function Expand1(){
if (!R1N.savesize) R1N.savesize=R1N.size;
if (!R2N.savesize) R2N.savesize=R2N.size;
if (!R3N.savesize) R3N.savesize=R3N.size;
var isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === '[object SafariRemoteNotification]'; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification));
var isIE = /*@cc_on!@*/false || !!document.documentMode;
offset = 0;
if (isSafari) offset = 4;
R1N.size=Math.max(R1N.savesize,R1N.value.length,R2N.value.length,R3N.value.length)-offset;
R2N.size=Math.max(R2N.savesize,R1N.value.length,R2N.value.length,R3N.value.length)-offset;
R3N.size=Math.max(R3N.savesize,R1N.value.length,R2N.value.length,R3N.value.length)-offset;
}
function Expand2(){
if (!C1N.savesize) C1N.savesize=C1N.size;
if (!One1.savesize) One1.savesize=One1.size;
if (!Two1.savesize) Two1.savesize=Two1.size;
if (!Three1.savesize) Three1.savesize=Three1.size;
var isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === '[object SafariRemoteNotification]'; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification));
var isIE = /*@cc_on!@*/false || !!document.documentMode;
offset = 0;
if (isSafari) offset = 4;
C1N.size=Math.max(C1N.savesize,C1N.value.length,One1.value.length,Two1.value.length,Three1.value.length)-offset;
One1.size=Math.max(One1.savesize,C1N.value.length,One1.value.length,Two1.value.length,Three1.value.length)-offset;
Two1.size=Math.max(Two1.savesize,C1N.value.length,One1.value.length,Two1.value.length,Three1.value.length)-offset;
Three1.size=Math.max(Three1.savesize,C1N.value.length,One1.value.length,Two1.value.length,Three1.value.length)-offset;
}
function Expand3(){
if (!C2N.savesize) C2N.savesize=C2N.size;
if (!One2.savesize) One2.savesize=One2.size;
if (!Two2.savesize) Two2.savesize=Two2.size;
if (!Three2.savesize) Three2.savesize=Three2.size;
var isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === '[object SafariRemoteNotification]'; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification));
var isIE = /*@cc_on!@*/false || !!document.documentMode;
offset = 0;
if (isSafari) offset = 4;
C2N.size=Math.max(C2N.savesize,C2N.value.length,One2.value.length,Two2.value.length,Three2.value.length)-offset;
One2.size=Math.max(One2.savesize,C2N.value.length,One2.value.length,Two2.value.length,Three2.value.length)-offset;
Two2.size=Math.max(Two2.savesize,C2N.value.length,One2.value.length,Two2.value.length,Three2.value.length)-offset;
Three2.size=Math.max(Three2.savesize,C2N.value.length,One2.value.length,Two2.value.length,Three2.value.length)-offset;
}
function Expand4(){
if (!C3N.savesize) C3N.savesize=C3N.size;
if (!One3.savesize) One3.savesize=One3.size;
if (!Two3.savesize) Two3.savesize=Two3.size;
if (!Three3.savesize) Three3.savesize=Three3.size;
var isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === '[object SafariRemoteNotification]'; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification));
var isIE = /*@cc_on!@*/false || !!document.documentMode;
offset = 0;
if (isSafari) offset = 4;
C3N.size=Math.max(C3N.savesize,C3N.value.length,One3.value.length,Two3.value.length,Three3.value.length)-offset;
One3.size=Math.max(One3.savesize,C3N.value.length,One3.value.length,Two3.value.length,Three3.value.length)-offset;
Two3.size=Math.max(Two3.savesize,C3N.value.length,One3.value.length,Two3.value.length,Three3.value.length)-offset;
Three3.size=Math.max(Three3.savesize,C3N.value.length,One3.value.length,Two3.value.length,Three3.value.length)-offset;
}
/*]]>*/
</script><style>
table{
border-color: #f3f7fb;
display: block;
overflow-x: auto;
}
th, td {
border: 1px solid black;
border-collapse: collapse;
padding: 6px;
}
input {
border: 0;
width: auto;
padding: 1px 8px;
background-color: #f5f5f5;
font-size: 1em;
}
</style>
<table id = 'mytable'>
<tbody>
<tr>
<td></td>
<td><input size='10' id='C1N'type = 'text' onchange='Expand2();' oninput='Expand2();' value='Column A'></td>
<td><input size='10' id='C2N'type = 'text' onchange='Expand3();' oninput='Expand3();' value='Column B'></td>
<td><input size='10' id='C3N'type = 'text' onchange='Expand4();' oninput='Expand4();' value='Column C'></td>
<td><div style='padding: 1px 8px'>Total</div></td>
</tr>
<tr>
<td><input size='1' id='R1N'type = 'text' onchange='Expand1();' oninput='Expand1();' value='Row 1'></td>
<td><input size='1' id='One1' type='text' onchange='Expand2();' oninput='Expand2();' value='0'></td>
<td><input size='1' id='One2' type = 'text' onchange='Expand3();' oninput='Expand3();' value='0'></td>
<td><input size='1' id='One3' type = 'text' onchange='Expand4();' oninput='Expand4();' value='0'></td>
<td><div size='1' style='padding: 1px 8px' id='TR1' class='shiny-text-output'></div></td>
</tr>
<tr>
<td><input size='1' id='R2N' type = 'text' onchange='Expand1();' oninput='Expand1();' value='Row 2'></td>
<td><input size='1' id='Two1' type = 'text' onchange='Expand2();' oninput='Expand2();' value='0'></td>
<td><input size='1' id='Two2' type = 'text' onchange='Expand3();' oninput='Expand3();' value='0'></td>
<td><input size='1' id='Two3' type = 'text' onchange='Expand4();' oninput='Expand4();' value='0'></td>
<td><div size='1' style='padding: 1px 8px' id='TR2' class='shiny-text-output'></div></td>
</tr>
<tr>
<td><input size='1' id='R3N' type = 'text' onchange='Expand1();' oninput='Expand1();' value='Row 3'></td>
<td><input size='1' id='Three1' type = 'text' onchange='Expand2();' oninput='Expand2();' value='0'></td>
<td><input size='1' id='Three2' type = 'text' onchange='Expand3();' oninput='Expand3();' value='0'></td>
<td><input size='1' id='Three3' type = 'text' onchange='Expand4();' oninput='Expand4();' value='0'></td>
<td><div size='1' style='padding: 1px 8px' id='TR3' class='shiny-text-output'></div></td>
</tr>
<tr>
<td><div style='padding: 1px 8px'>Total</div></td>
<td><div size='1' style='padding: 1px 8px' id='TC1' class='shiny-text-output'></div></td>
<td><div size='1' style='padding: 1px 8px' id='TC2' class='shiny-text-output'></div></td>
<td><div size='1' style='padding: 1px 8px' id='TC3' class='shiny-text-output'></div></td>
<td><div size='1' style='padding: 1px 8px' id='Total' class='shiny-text-output'></div></td>
</tr>
</tbody>
</table>")