Applied filter on Manipulate Data, but not work if data in tables manipulated

Applied filter on Manipulate Data, but not work if data in tables manipulated

muhammadrifqi32muhammadrifqi32 Posts: 3Questions: 1Answers: 0

So i tried to add filter from this link https://www.datatables.net/examples/api/multi_filter_select.html into my project into like this

                column
                    .data()
                    .unique()
                    .sort()
                    .each(function (d, j) {
                        debugger;
                        if (d == 0) {
                            select.append('<option value="' + j + '">Tidak Aktif</option>');
                        }
                        else {
                            select.append('<option value="' + d + '">Aktif</option>');
                        }

The data that i got is the 'isDeleted' column, which value is 0 or 1.
Then i manipulated the code into this

    "columns": [
        {
            "render": function (data, type, row) {
                if (row.isDeleted == 1) {
                    return '<p>Aktif</p>'
                }
                else {
                    return '<p>Tidak Aktif</p>'
                }
            }
        }],

But if i manipulated the is Deleted data, the filter not work.

is there any solution?

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • muhammadrifqi32muhammadrifqi32 Posts: 3Questions: 1Answers: 0

    Thanks colin for remindering me.
    So here's the test case
    http://live.datatables.net/wajidelu/1/edit

    My problem is, the filter only work, if the value from the table same with the API .
    I can customize the filter value while the data on the table still print 0 / 1.

    The thing that i want to do is,
    I can applied the filter, eventhough the data printed on datables already customize (not it's origin value, rather it 0/1)

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    Use Orthogonal data to return the text for only the display operation. For example:
    http://live.datatables.net/wajidelu/2/edit

    Kevin

  • muhammadrifqi32muhammadrifqi32 Posts: 3Questions: 1Answers: 0

    Hi Kevin,
    I've been try your solution.
    The data in tables can customize,

    but the filter still not work

    FYI, my data is from my local API.
    So the test case just for demo purpose.
    Is the code different if the data is from the API?

Sign In or Register to comment.