trk_datatables 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +19 -1
- data/lib/trk_datatables/dt_params.rb +1 -1
- data/lib/trk_datatables/render_html.rb +2 -1
- data/lib/trk_datatables/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 520b6d86f27312cd4c8bb89e62943f542be727954446ce8c4be03790727f7a4d
|
4
|
+
data.tar.gz: dd881cc122ffd0cbec3eca16db24ed65cfc98921d22080920d8df167a8c7260c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7f62cc8d55ca17597c9c65d3aaf646f16f92a94873b97c83847e6e01f843f951ec74796e8064ed81cab802a404599006b3a7c321ecb672fc909c9f5e669724c
|
7
|
+
data.tar.gz: 27ea4d1cf61af80539f66502256a173c603416030da3943947fcf5d43eaefd068fe0112a7fa0d87aa2cca493f77b759c76f3c151afd1ecd3d85c44b1804e7216
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -552,6 +552,24 @@ class PostsDatatable
|
|
552
552
|
end
|
553
553
|
```
|
554
554
|
|
555
|
+
### Render html with additional css class and different DOM
|
556
|
+
|
557
|
+
To add additional styling to your datatable you can use `:class` option when you
|
558
|
+
are calling `@datatable.render_html url, options` for example
|
559
|
+
|
560
|
+
```
|
561
|
+
<%= @datatable.render_html search_posts_path(format: :json), class: 'table-hover' %>
|
562
|
+
```
|
563
|
+
|
564
|
+
Default [DOM](https://datatables.net/reference/option/dom) is
|
565
|
+
`<"trk-global-search-wrapper"f>rtp<"trk-move-up"il>` which includes global
|
566
|
+
**f**iltering, p**r**ocessing loader, **t**able search, **p**agination, table
|
567
|
+
**i**nformation and **l**ength changing control. To override you can use
|
568
|
+
|
569
|
+
```
|
570
|
+
<%= @datatable.render_html search_posts_path(format: :json), 'data-datatable-dom': 'rt' %>
|
571
|
+
```
|
572
|
+
|
555
573
|
### Params
|
556
574
|
|
557
575
|
To set parameters that you can use for links to set column search value, use
|
@@ -599,7 +617,7 @@ For global search you can use `[search][value]` for example
|
|
599
617
|
If you need, you can fetch params with this helper
|
600
618
|
|
601
619
|
```
|
602
|
-
|
620
|
+
datatable.param_get 'users.email'
|
603
621
|
```
|
604
622
|
|
605
623
|
You can set filters on datatable even params are blank, for example
|
@@ -117,7 +117,7 @@ module TrkDatatables
|
|
117
117
|
def param_get(column_index)
|
118
118
|
@params.dig :columns, column_index.to_s, :search, :value
|
119
119
|
rescue TypeError => e
|
120
|
-
raise Error, e.message
|
120
|
+
raise Error, "#{e.message}. Column search is in a format: { \"columns\": { \"0\": { \"search\": { \"value\": { \"ABC\" } } } } }"
|
121
121
|
end
|
122
122
|
|
123
123
|
def self.sample_view_params(options = {})
|
@@ -4,7 +4,7 @@ module TrkDatatables
|
|
4
4
|
def initialize(search_link, datatable, html_options = {})
|
5
5
|
@search_link = search_link
|
6
6
|
@datatable = datatable
|
7
|
-
@html_options = html_options
|
7
|
+
@html_options = html_options.symbolize_keys
|
8
8
|
self.class.indent = 0
|
9
9
|
end
|
10
10
|
|
@@ -89,6 +89,7 @@ module TrkDatatables
|
|
89
89
|
# for initial page load we do not have ability to show recordsTotal
|
90
90
|
# https://github.com/trkin/trk_datatables_js/issues/1
|
91
91
|
'data-datatable-total-length': @datatable.filtered_items_count,
|
92
|
+
'data-datatable-dom': @html_options[:'data-datatable-dom'] || '<"trk-global-search-wrapper"f>rtp<"trk-move-up"il>',
|
92
93
|
) do
|
93
94
|
thead << "\n".html_safe << tbody
|
94
95
|
end +
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trk_datatables
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dusan Orlovic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|