Giter Club home page Giter Club logo

Comments (9)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024

Original comment by [email protected] on 24 Sep 2011 at 11:03

  • Changed state: Accepted

from jquery-datatables-column-filter.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
Great, thank you for including that in!

Original comment by [email protected] on 25 Sep 2011 at 10:48

from jquery-datatables-column-filter.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
nice job!
Tnx



Rob

Original comment by [email protected] on 26 Sep 2011 at 5:04

from jquery-datatables-column-filter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.