Skip to content
Snippets Groups Projects
TwoProportionSourceThree.R 8.94 KiB
Newer Older
# 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>")