A.G.Progm.Enthusiast
A.G.Progm.Enthusiast

Reputation: 1010

How to filter values in webix datatable when column id is missing in table dataset?

I have a webix table data set which is just a plain array without any column ID. Because of that the column filtering is not working. I tried with onAfterFilter event but not quite sure of how to use it to get the filtering work.

My snippet is here : https://snippet.webix.com/t4ctlw30

The constraint is that I can not change the dataset to add a column Id. How can this filleting be made work ?

Thanks.

Upvotes: 0

Views: 1074

Answers (1)

Aquatic
Aquatic

Reputation: 5144

While IDs are important, they are not mandatory. The issue caused by the wrong data format. Component expects array of objects, not an array of strings

var mydata = [{ user:"smith"}, { user:"mark"}];

and the related column configuration

{ id:"members",   id:"user",   header:["members",
     {content:"textFilter"}
  ], width:100, sort:"string" }

Here is the working snippet - https://snippet.webix.com/mzsb3e9h

If it is really critical, it possible to customize component so it will read an array of the strings, it can be done throug a custom data driver - https://docs.webix.com/helpers__data_drivers.html

Upvotes: 1

Related Questions