diff --git a/app/controllers/universal_tables_controller.rb b/app/controllers/universal_tables_controller.rb index e5ce1b4..d73249f 100644 --- a/app/controllers/universal_tables_controller.rb +++ b/app/controllers/universal_tables_controller.rb @@ -17,6 +17,7 @@ class UniversalTablesController < ApplicationController end query_string += "&page_no=#{params_no}" if params_no.present? csrf_input = "" + have_serial_number = (page.layout != 'index1') table_heads = table.table_columns.where(:display_in_index => true).asc(:order).collect do |tc| field_key = tc.key field_value = params_q[field_key] @@ -97,9 +98,28 @@ class UniversalTablesController < ApplicationController rows = [] entries = get_entries(params, table, page) total_pages = entries.total_pages + if have_serial_number + page_no_offset = (params_no.present? ? [0, params_no.to_i - 1].max : 0) + serial_number_count = page_no_offset * OrbitHelper.page_data_count + table_heads.insert(0, { + "title" => "No.", + "type" => "", + "key" => "", + "search" => "hide", + "form-field" => "", + "sort" => "hide", + "sort-class" => "sort hide", + "sort-url" => "", + "title-class" => " no-search" + }) + end entries.each do |te| cols = [] sort_value = "" + if have_serial_number + serial_number_count += 1 + cols << {"text" => serial_number_count.to_s} + end tablecolumns.each do |column| ce = te.column_entries.where(:table_column_id => column.id).first rescue nil if !ce.nil? diff --git a/modules/universal_table/index2.html.erb b/modules/universal_table/index2.html.erb index 5aa43eb..8bef303 100644 --- a/modules/universal_table/index2.html.erb +++ b/modules/universal_table/index2.html.erb @@ -36,21 +36,9 @@ .universal-table-index tbody { counter-reset: item; } - - .universal-table-index tbody > tr > td:first-child:before { - content: counter(item); - counter-increment: item; - } - - - .universal-table-index thead > tr > th:first-child:before { - content: "No."; - } - .universal-table-index thead > tr > th:first-child { width: 4em; } - .universal-th-icon { border: 1px solid #eee; padding: 5px 8px; @@ -102,7 +90,3 @@