Search Panes - dealing with arrays when not using ajax json data
Search Panes - dealing with arrays when not using ajax json data

Hello,
I saw the example of how to work with an array when using ajax json data
https://datatables.net/extensions/searchpanes/examples/advanced/renderSearchArrays.html
Is that also possible with a 'statically' generated table, i.e. without ajax? If so - any hint on how?
Cheers
This discussion has been closed.
Answers
The data source doesn't matter. What does matter is the structure of your original data. You may need to handle the orthogonal data with
columns.render
. Can you build a simple test case representing your data and a description of what you except so we can help?https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Here is an example where I need to shorten a filepath:
Kevin
Hi Kevin
Yeah, you're right - I managed to get to the render part indeed.
Here's the example I created.
Basically, I need the 4th column to be treated as array and shown in the panes (preferably with a 'tag like' formatting).
http://live.datatables.net/toraqudo/1/edit?html,css,js,output
Here is an example:
http://live.datatables.net/tevisiha/3/edit
I updated a couple of the tags to have some different data for each row.
The place to start is to understand the data in the column. I used
console.log(data);
as the first step to see what Datatables is using as the data. Then I built upon that to eventually use jQuery to loop through all thei
tags and extract the desired data points for Search Panes.I haven't quite figured out the
columns.searchPanes.threshold
yet but had to set it to 4 to display the tags.Kevin
searchPanes.threshold
is a value from 0 to 1, so something odd going on here since as you say, it needs a value of 4 to appear.I've raised it internally (DD-1350 for my reference) and we'll report back here when there's an update.
Cheers,
Colin
Thank you both!
The problem here was that you had 6 unique values over 2 rows, which meant the uniqueness ratio was 3 - something we hadn't anticipated. We've changed this now for columns with array values like yours to be
uniqueArrayOptions/totalArrayEntries
, so giving a threshold of6 / 8 = 0.75
.This has been addressed. It'll be in the next release, but you can confirm the solution by using the nightly releases here. Example here.
Colin