ColumnControl searchList when cell data is an array.

ColumnControl searchList when cell data is an array.

coreyg142coreyg142 Posts: 1Questions: 0Answers: 0

I have a Datatable with columns containing array data ["option1", "option2" "option3"].

The column is created with these options:

  {
    data: "example_column",
    name: "example_column",
    render: (data: any, type: any) => {
      if (type === "display") {
        return `<div class="mount-col" data-value='${JSON.stringify(data)}'></div>`;
      }
      return data;
    }

(This is for a Vue project, and I am mounting custom tag components to the rendered div using createdRow. That is why display is rendering empty divs)

{
    targets: ["example_column:name"],
    columnControl: [
        [{
            extend: "searchList",
            orthogonal: "searchList"
        }]
    ]
}

This results in the searchList's filter options to consist of the arrays joined as a single string for each row "option1,option2,option3"

Ideally I would want each array element to be a selectable option, and it would filter the rows to only ones with arrays that contain the selected options.

Is this possible at all?

Here's an example table https://live.datatables.net/coratibu/2/edit

Replies

  • allanallan Posts: 65,445Questions: 1Answers: 10,870 Site admin

    Currently no, I'm afraid this isn't possible in ColumnControl. It is something that I plan to add in a future version. SearchPanes does have array capability already, but ColumnControl does not yet. Sorry.

    Allan

Sign In or Register to comment.