Unable to do column().search() on render/filter data

Unable to do column().search() on render/filter data

garuda_onegaruda_one Posts: 9Questions: 0Answers: 0

I have individual column searching (in addition to the global search), and the column searches aren't hitting my filter data.

Initialization of one of these columns:

{
   data: "Date", name: "date", render: function (data, type, row) {
      if (type === 'display' || type === 'filter') {
         return new Date(data).toLocaleDateString();
      }
      return data;
   }
}

and the column search setup:

$("#my-table .filter-row input").each(function(i) {
   $(this).on('keyup change', function() {
      table.columns(i).search($(this).val()).draw();
   });
});

Screenshots (imgur):
Global search success
Column search fail

Does column().search() not use the filter data source? Or am I (more likely) overlooking something?

Replies

  • garuda_onegaruda_one Posts: 9Questions: 0Answers: 0

    To add some more info - the date data comes as something like 2018-05-22T13:11:51.627, and doing a column search on 2018-05 also yields no results

  • garuda_onegaruda_one Posts: 9Questions: 0Answers: 0

    ...OK, really should have prepared for this post better. Now that I'm paying attention, that column curiously only ever returns one hit, and it's the same row every time. If I type 0 into that column search, it will return a row whose Date field is 2/28/2018. That same result also comes up if I type 2, 20, or 201, but the search returns nothing on 2018. Now I KNOW I'm overlooking something...

  • garuda_onegaruda_one Posts: 9Questions: 0Answers: 0

    Not sure how to edit my post, but I've updated the column search to not use smart search (this hasn't changed any of my problems, though)

    // ...
    table.columns(i).search($(this).val(), false, false, true).draw()
    //...
    
  • garuda_onegaruda_one Posts: 9Questions: 0Answers: 0

    Yup.......................................................................................................................................................................................................................................................................................................................................................my column operations are off because I have hidden columns. So everything is working as intended................ :)

This discussion has been closed.