Column filter on select does not work when using mRender

Column filter on select does not work when using mRender

HollywoodHollywood Posts: 2Questions: 2Answers: 0

Hi Experts,

I am using the example Individual column searching (select inputs) and it is working well.:
https://datatables.net/reference/api/column().search()
I changed footer() to header() which works well also.

But when i use mRender like this the above technic will not filter. Nothing happens.

{
                "title": "Gender", "className": "dt-center", "sWidth": "50px", "mRender": function (oObj) {
                    var retval = '<select id="Gender" onchange="collaboration.onChangeGender(this)">' + '<option {0} value="Male">Male</option>' + '<option {1} value="Female">Female</option>';
                    if (oObj === "Male") {
                        retval = retval.replace("{0}", "selected");
                        retval = retval.replace("{1}", "");
                    }
                    if (oObj === "Female") {
                        retval = retval.replace("{1}", "selected");
                        retval = retval.replace("{0}", "");
                    }

                    return retval + '</select>';
                }
            }

Because I render my Selects as mentioned I removed following Portion from the example:

column.data().unique().sort().each( function ( d, j ) {
        select.append( '<option value="'String+d+'">'String+d+'</option>'String )
 } );

Not featured?
Best Regards, Ronny

Answers

This discussion has been closed.