Only display if column includes x...

Only display if column includes x...

gavohgavoh Posts: 3Questions: 1Answers: 0

Hi,
I am using this to display several rows of data. One of the columns is "Location".

I would like to be able to restrict the datatable so that it only shows entries where the location field includes a word or term.

eg: If location includes "Chicago" then display, otherwise do not.

Thank you
Gavin

Answers

  • algeealgee Posts: 11Questions: 2Answers: 0
    edited April 2016

    i guess this is what you are looking for:

    http://datatables.net/reference/api/columns%28%29.search%28%29

  • gavohgavoh Posts: 3Questions: 1Answers: 0

    It is something I want to have hard coded in

  • gavohgavoh Posts: 3Questions: 1Answers: 0

    Never mind, solved with...

            var table = $('#example').DataTable({
    "oSearch": {"sSearch": "LOCATION" }
    

    });
    $.urlParam = function(name){
    var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
    if (!results)
    {
    return;
    }
    return results[1] || "";
    };
    }

This discussion has been closed.