require 'daru/view'
true
Daru::View.table_library = :datatables
/home/shekharrajak/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/bundler/gems/daru-data_tables-af3460a049da/lib/daru/data_tables/version.rb:3: warning: already initialized constant Daru::View::VERSION /home/shekharrajak/Documents/githubRepos/sciruby/windows-daru-view/daru-view/lib/daru/view/version.rb:3: warning: previous definition of VERSION was here
:datatables
df = Daru::DataFrame.new({b: [11,12,13,14,15], a: [1,2,3,4,5],
c: [11,22,33,44,55]},
order: [:a, :b, :c],
index: [:one, :two, :three, :four, :five])
a | b | c | |
---|---|---|---|
one | 1 | 11 | 11 |
two | 2 | 12 | 22 |
three | 3 | 13 | 33 |
four | 4 | 14 | 44 |
five | 5 | 15 | 55 |
dt_df = Daru::View::Table.new(df, pageLength: 3)
#<Daru::View::Table:0x0000564b9eb7b9a8 @data=#<Daru::DataFrame(5x3)> a b c one 1 11 11 two 2 12 22 three 3 13 33 four 4 14 44 five 5 15 55, @options={:pageLength=>3, :data=>[[0, 1, 11, 11], [1, 2, 12, 22], [2, 3, 13, 33], [3, 4, 14, 44], [4, 5, 15, 55]]}, @user_options={}, @adapter=Daru::View::Adapter::DatatablesAdapter, @table=#<Daru::View::DataTable:0x0000564b9eb7b908 @html_options={:table_options=>{:class=>"display", :cellspacing=>"0", :width=>"100%"}}, @data=#<Daru::DataFrame(5x3)> a b c one 1 11 11 two 2 12 22 three 3 13 33 four 4 14 44 five 5 15 55, @options={:pageLength=>3, :data=>[[0, 1, 11, 11], [1, 2, 12, 22], [2, 3, 13, 33], [3, 4, 14, 44], [4, 5, 15, 55]]}>>
dt_df.show_in_iruby
a | b | c |
---|
table_opts = {
class: "display",
cellspacing: "0",
width: "50%",
table_html: "
<thead>
<tr>
<th>Num1 </th>
<th>Num2 </th>
<th>Num3 </th>
</tr>
</thead>"
}
options = {
table_options: table_opts
}
html_code_dt_df = dt_df.table.to_html(id='table_id4', options)
"\n<script type='text/javascript'>\n \n$(document).ready(function() {\n\n\t$('#table_id4').DataTable(\n\t\t{pageLength: 3, data: [[0,1,11,11],[1,2,12,22],[2,3,13,33],[3,4,14,44],[4,5,15,55]]}\n\t);\n\n});\n</script>\n<table class=\"display\" cellspacing=\"0\" width=\"100%\" id=\"table_id4\"><thead>\n \n <tr>\n <th></th>\n \n <th>a</th>\n \n <th>b</th>\n \n <th>c</th>\n \n </tr>\n \n</thead></table>"
IRuby.html html_code_dt_df
a | b | c |
---|