diff --git a/demo_rails/app/controllers/application_controller.rb b/demo_rails/app/controllers/application_controller.rb
index 0b82e00..e2ab76b 100644
--- a/demo_rails/app/controllers/application_controller.rb
+++ b/demo_rails/app/controllers/application_controller.rb
@@ -282,17 +282,38 @@ def googlecharts
def datatables
# need to give name, otherwise generated thead html code will not work.
# Because no name means no thead in vector.
- dv = Daru::Vector.new [:a, :a, :a, :b, :b, :c], name: 'series1'
+ dv = Daru::Vector.new [1, 2, 3, 4, 5, 6], name: 'series1'
+ options = {
+ adapter: :datatables,
+ html_options: {
+ table_options: {
+ table_thead: "
+
+
+ ",
+ width: '90%'
+ }
+ }
+ }
# default adapter is nyaplot only
- @dt_dv = Daru::View::Table.new(dv, pageLength: 3, adapter: :datatables)
- @dt_dv_html = @dt_dv.div
+ @dt_dv = Daru::View::Table.new(dv, options)
df1 = 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])
- @dt_df1 = Daru::View::Table.new(df1, pageLength: 3, adapter: :datatables)
- @dt_df1_html = @dt_df1.div
+ options2 = {
+ adapter: :datatables,
+ html_options: {
+ table_options: {
+ cellspacing: '0',
+ width: "100%"
+ }
+ }
+ }
+ @dt_df1 = Daru::View::Table.new(df1, options2)
df2 = Daru::DataFrame.new({
a: [1, 3, 5, 7, 5, 0],
@@ -300,24 +321,9 @@ def datatables
c: [1, 6, 7, 2, 6, 0]
}, index: 'a'..'f')
@dt_df2 = Daru::View::Table.new(df2, pageLength: 3, adapter: :datatables)
- @dt_df2_html = @dt_df2.div
- # user can change the table options using following code :
- #
- # table_opts = {
- # class: "display",
- # cellspacing: "0",
- # width: "50%",
- # table_html: 'new table thead and tbody html code'
- # }
- # options = {
- # table_options: table_opts
- # }
- #
- # @dt_df2.table.to_html(id='id1', options)
-
- dv_arr = [:a, :a, :a, :b, :b, :c]
+
+ dv_arr = [1, 2, 3, 4, 5, 6]
@dt_dv_arr = Daru::View::Table.new(dv_arr, pageLength: 3, adapter: :datatables)
- @dt_dv_arr_html = @dt_dv_arr.div
df1_arr = [
[11,12,13,14,15],
@@ -325,7 +331,6 @@ def datatables
[11,22,33,44,55]
]
@dt_df1_arr = Daru::View::Table.new(df1_arr, pageLength: 3, adapter: :datatables)
- @dt_df1_arr_html = @dt_df1_arr.div
df2_arr = [
[1, 3, 5, 7, 5, 0],
@@ -333,8 +338,17 @@ def datatables
[1, 6, 7, 2, 6, 0]
]
@dt_df2_arr = Daru::View::Table.new(df2_arr, pageLength: 3, adapter: :datatables)
- @dt_df2_arr_html = @dt_df2_arr.div
+ data = []
+ for i in 0..100000
+ data << i
+ end
+ options = {
+ searching: false,
+ pageLength: 7,
+ adapter: :datatables
+ }
+ @table_array_large = Daru::View::Table.new(data, options)
end
diff --git a/demo_rails/app/views/application/datatables.erb b/demo_rails/app/views/application/datatables.erb
index b03bb96..0c2af0c 100644
--- a/demo_rails/app/views/application/datatables.erb
+++ b/demo_rails/app/views/application/datatables.erb
@@ -1,12 +1,23 @@
+
+ Demo Column Name
+
+ Data :
+ A large set of data
+
+ Table :
+
+
Data :
- <%=raw @dt_df2.data.to_html %>
+ <%=raw @dt_df2.data %>
Table :
-
Data :
- <%=raw @dt_df1.data.to_html %>
+ <%=raw @dt_df1.data %>
Table :
-
Data :
- <%=raw @dt_dv.data.to_html %>
+ <%=raw @dt_dv.data %>
Table :
-