Comments (9)
I try to explain it a bit different:
I would like to be able to define the values and labels for the options:
{type: "select",values: ["val1","val2"],labels:["label1","Label2"]}
this way i can do a search for a certain value, but give it another name in the
select dropdown.
in the columnfilter code is a loop to extract all the values from the aData
array.:
r += '<option value="' + aData[j] + '">' + aData[j] + '</option>';
I just can't figure out how i can get the labels in another array.
any idea is more then welcome.
Original comment by [email protected]
on 15 Jul 2011 at 2:46
from jquery-datatables-column-filter.
This functionality is not builtin, but the way I would handle it would be to do
something along the lines of:
{ type: "select", options: [{'value': 'val1', 'label': 'label1'}, {'value':
'val2', 'label': 'label2'}, {'value': 'val3', 'label': 'label3'}] }
and perhaps:
r += '<option value="' + aData[j].value + '">' + aData[j].label + '</option>';
This is untested code but should get you on the right path.
Original comment by [email protected]
on 29 Jul 2011 at 2:53
from jquery-datatables-column-filter.
On second thought, this would allow the code to be backwards compatible:
if(typeof(aData[j]) != 'object')
r += '<option value="' + aData[j] + '">' + aData[j] + '</option>';
}
else {
r += '<option value="' + aData[j].value + '">' + aData[j].label + '</option>';
}
Again untested, but that should allow it to work with the old method as well as
the method you are trying to use.
Original comment by [email protected]
on 29 Jul 2011 at 3:01
from jquery-datatables-column-filter.
I had a missing { in that if statement, it should have been:
for (j = 0; j < iLen; j++) {
if(typeof(aData[j]) != 'object') {
r += '<option value="' + aData[j] + '">' + aData[j] + '</option>';
}
else {
r += '<option value="' + aData[j].value + '">' + aData[j].label + '</option>';
}
}
Still haven't tested that this actually works, but I have included it in my
version and it no longer throws errors for simply being there.
Original comment by [email protected]
on 29 Jul 2011 at 3:20
from jquery-datatables-column-filter.
Well actually I ended up needing this functionality myself so I went ahead and
finished the code. Basically what I provided earlier was almost working, I just
hadn't followed everything through.
To ensure backwards compatibility, you would need to use this:
{ type: "select", values: [{'value': 'val1', 'label': 'label1'}, {'value':
'val2', 'label': 'label2'}, {'value': 'val3', 'label': 'label3'}] }
(Note that we are keeping "values" instead of "options" as I had originally
used. I think "options" is better named, but it breaks backwards compatibility.)
Then this change to the option looping, again ensuring backwards compatibility:
for (j = 0; j < iLen; j++) {
if(typeof(aData[j]) != 'object') {
r += '<option value="' + aData[j] + '">' + aData[j] + '</option>';
}
else {
r += '<option value="' + aData[j].value + '">' + aData[j].label + '</option>';
}
}
I have tested this as working. Good luck!
Original comment by [email protected]
on 20 Aug 2011 at 10:56
from jquery-datatables-column-filter.
Original comment by [email protected]
on 24 Sep 2011 at 11:03
- Changed state: Accepted
from jquery-datatables-column-filter.
Hi,
This code is added in the version 1.2.4.
Thanks,
Jovan
Original comment by [email protected]
on 25 Sep 2011 at 12:33
- Changed state: Fixed
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
from jquery-datatables-column-filter.
Great, thank you for including that in!
Original comment by [email protected]
on 25 Sep 2011 at 10:48
from jquery-datatables-column-filter.
nice job!
Tnx
Rob
Original comment by [email protected]
on 26 Sep 2011 at 5:04
from jquery-datatables-column-filter.
Related Issues (20)
- Change sAjaxSource
- Datatables show/hide columns disturbs column filtering
- How to style columnFiltering
- apply filters to several tables
- CSS bootstrap and number_range_filter HOT 1
- Server side Processing is not working HOT 1
- ColumnFilter doesn't work with columns with hyperlink HOT 1
- How to Filter Exact match value in cloumnFilter.js?
- how to search when i were select a comboxlist,then the second comboxlist value show the relationship of the first comboxlist
- IE10+ touch events not supported
- Default Filtervalue not send when bServerSide processing
- select with checkboxes
- Datatable select filters with checkboxes
- how to clear multi colum filter in datatable
- Unable to sort when using the plugin
- type:slect not working
- Checkbox not able to filter that contain symbol
- text-range filtering
- Issue on responsive jquery datatables + external form column filter
- When date fields are null, no data is diplayed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-datatables-column-filter.