Hao Zhu | eaef431 | 2018-01-10 17:05:23 -0500 | [diff] [blame] | 1 | HTMLWidgets.widget({ |
| 2 | |
| 3 | name: "kableWidget", |
| 4 | |
| 5 | type: "output", |
| 6 | |
| 7 | factory: function(el, width, height) { |
| 8 | return { |
| 9 | renderValue: function(x) { |
| 10 | $(el).empty(); |
| 11 | // Select number of rows to see: |
| 12 | var select_entries_div = document.createElement('div'); |
| 13 | var select_entries_div_id = (el.id).concat('_entries'); |
| 14 | $(select_entries_div).attr('id', select_entries_div_id); |
| 15 | $(el).append(select_entries_div); |
| 16 | // Add the table: |
| 17 | $(el).append(x.thetable); |
| 18 | /// The navigation bar: |
| 19 | var nav_obj = document.createElement('div'); |
| 20 | var nav_id = (el.id).concat('_nav'); |
| 21 | $(nav_obj).attr('id', nav_id); |
| 22 | $(el).append(nav_obj); |
| 23 | // Set instance variables: |
| 24 | var thetable = $(el).find('table'); |
| 25 | $(el).css("position","relative"); |
| 26 | $(el).css("clear","both"); |
| 27 | $(thetable).css("width","100%"); |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | }) |