Q: col custom search + formatting
See original GitHub issueI’ve found this brilliant gem a few days ago.
I have a cell with a JSON serialized array. I need to list these items in a DataTable cell and I also need to search through them. As easy as it is to implement each of these requirements, I have spent the better part of the day trying to figure out how to achieve both.
- For the display part I did
col :participants, partial: 'participants/table_item', partial_as: 'event'
and put
in the partial.<ul> <% JSON::parse(event.participants).each do |p| %> <li><%= p %></li> <% end %> </ul>
- For the search part I’ve set up full text search in PostgreSQL so that
Event.search_participants()
does the searching and I can write:col :participants do |event| event.participants end.search do |collection, term, column, sql_column| collection = Event.search_participants(term) end
I would like to put these together, but I cannot as You cannot use partial: … with the block syntax So I tried
col :participants do |event|
tag.ul do
JSON.parse(event.participants).each do |participant|
tag.li participant
end.search do |collection, term, column, sql_column|
collection = Decision.search_participants(term)
end
end
end
but this render just an empty <ul></ul>
. What am I doing wrong here?
Funnily I’ve skimmed through some old documentation too and it seems like overriding search_column
method would suffice in the past.
Issue Analytics
- State:
- Created 5 years ago
- Comments:16 (8 by maintainers)
Top Results From Across the Web
Table | Quasar Framework
It's generally called a datatable. It packs the following main features: Filtering; Sorting; Single / Multiple rows selection with custom selection actions ...
Read more >Implementing search box | Programmable Search Engine
In the Control Panel click the search engine you want to use. Click Setup in the sidebar, and then click the Basics tab....
Read more >Use conditional formatting to highlight information
How to use conditional formatting in Excel to visually explore, analyze, and identify patterns and trends.
Read more >Custom Format Columns in SalesLogix Web (and Linking to ...
In this scenario, we'll just use a sample of adding a hyperlink into the Account Contacts grid to do a Google search on...
Read more >Excel conditional formatting formulas based on another cell
Enter the formula in the corresponding box. Click the Format… button to choose your custom format. Switch between the Font, Border and Fill ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is your category a
belongs_to
object? Or just a string?That query makes me think datatables is detecting it like a string
ILIKE %93%
but thedecision_category_id
makes me think it’s a belongs_to? Not sure what’s up there.Something like this should work tho:
or
Or maybe the join syntax could work
thanks for coming back with the solution!