Datatable with ServerSide sort/filter for column having values with render ?

Datatable with ServerSide sort/filter for column having values with render ?

rohandaverohandave Posts: 1Questions: 1Answers: 0
edited July 2019 in Free community support

Hi experts,

I am using jQueryDataTable with servereSide processing and using NodeJs.

I have one Listing page having some columns (number, subject) and so on.

columns = [
{ data: "number" },
{ data: "subject",
  render: function(data, type, row) {
    var label = data + (row.type === 21 ? " (Callout)" : "");
     return label
  }
}
{ data: "status",
  render: function(data, type, row) {
    var statusName = "";
    switch(data) {
        case 1:
            statusName = "Approved";
            break;
        case 2:
            statusName = "In-Progress";
            brreak;
        case 3:
            statusName = "Complete";
            break;
        default:
            statusName = "Draft";
            break;
    }
  } 
}
]

As you can see the "Subject" column renders the data by appending "(Callout)" in database value. This "(Callout)" text is not saved in database column but we show it runtime by checking condition.

Now my question is about "Search" functionality.

If i use clientSide processing then it search well if search with "(Call" OR "(Ca" and so on.

But if i use serverSide processing then it not search for "(Callour" OR "(Ca" etc. The reason is that text is not saved in database column and serverSide processing call the DB when we do sort / search.

I also have one more column "Status" which has same thing, we are storing 'StatusId' in database but showing text of Status by render in listing. So how to sort / search for that as well ? As if i apply ORDER BY statusId ASC / DESC then also list not sort correctly

So is there anyway i can search it ?

Can you please help me here ?

Thanks,
Rohan Dave

Answers

  • colincolin Posts: 15,143Questions: 1Answers: 2,586

    Hi @rohandave ,

    The supplied serverSide scripts don't support regexs, as it's assumed the data will be too large and the search will be inefficient. The server side scripts can be modified though to support those searches if needed.

    Cheers,

    Colin

This discussion has been closed.