Live filtering of dataviewjs table

I looked at your post, but I’m afraid, I didn’t understand much. Maybe it’s my poor understanding of English, but I’m just confused about what are you trying to do. I’m also not really that much of a technical person either, I just happen to know a bit of javascript.

The basic principles of my script are pretty simple. The table is filtered based on the value, stored in the frontmatter of the current note. Change the value - filtering is changed too. Than we add the button that changes the value in the frontmatter, so we have not to do it manually. The button script takes all the pages, finds the needed properties in them and creates the list of property values to suggest - then puts the chosen value to the frontmatter. Then there is a lot of code to create suggester modals, to apply the different rules for different types of properties, etc. What part are you exactly need help with?

About your question - your mean the button changing color? You need to apply some css to it. The active button gets the class “button-blue” (actually I justh thought that I should change it to something more semantic, but nevermind), then I add the snippet:

button.button-blue {
  background-color: rgba(102,140,179, .2);
  border-color: rgba(102,140,179, .4);
}

Я говорю на русском, поэтому предлагаю перейти на него. Извините за долгий ответ. К сожалению, ваш snippet у меня не действует. Я менял дизайн кнопки в вашей таблице только за счет изменения дефолтной кнопки. С изменением дизайна обычных кнопок проблем нет.

Кроме того, по какой-то причине у меня работает только ваша старая таблица. Новая версия с multiselection выдает ошибку:

И подскажите пожалуйста, как можно добавить фильтрацию страниц. В dataviewjs почти не разбираюсь.

Судя по ошибке, у вас скрипт вообще не подключился. Возможно, путь к файлу неправильно указан. Можете показать ваш код?

Со старой таблицей цвет кнопки работать и не будет, там не было этого функционала. Нужно класс к кнопке добавлять.

Сложно объяснять, как сделать пагинацию, если вы в джаваскрипте не разбираетесь. Это довольно большой кусок кода. Лучше всё-таки попробовать скрипт подключить нормально.

Я собственно ваш код и не менял. Я создал отдельное хранилище, объекты которого я сделал исходя из значений атрибутов в вашем коде. Видимо, я допустил какую-то примитивную ошибку)

```dataviewjs
await dv.view("_/scripts/views/dv_filter_functions")
const df = new dataviewFunctions
let current = dv.current()
let view = current.view
let views = ["View1", "View2"]
let defaultView = "View1"
let paginationNum = 20
let filteredPages = []
let props = []
let  newNote = {
		buttonName: "+", 
		fileName: "New note", 
		templatePath: "_/templates/New note.md", 
		folderName: "Inbox", 
		open: true
	}
let pages = dv.pages('"Test folder"')
 
await df.changeViewButton(views, "view", defaultView)

if (!view) view = defaultView



if (view == "View1") {

  pages = pages.filter(p => p.type == "type 1" )
  
  props = [
  {prop: "link", type: "file prop", header: "Name"},
  {prop: "tags", type: "list", multiSelect: true, span: true, buttonName: "Tags", header: "Tags"}
  ]
    
   newNote.templatePath = "_/templates/Template 1.md"
   newNote.folderName = "Folder 1"
 

} else if (view == "View2") {

  pages = pages.filter(p => p.type == "type 2" )
  
  props = [
  {prop: "link", type: "file prop", header: "Name"},
  {prop: "category", type: "text", buttonName: "Category", header: "Category"},
  {prop: "cover", type: "text", imageWidth: 100, header: "Cover"},
  {prop: "check", type: "boolean", header: "Check", buttonName: "Check"}
  ]
    
   newNote.templatePath = "_/templates/Template 2.md"
   newNote.folderName = "Folder 2"
 
}
 
filteredPages = [...pages]
await df.newEntryButton(newNote)
await df.createTable(props, pages, filteredPages, paginationNum)
```

You are using my path to the script file, but your file has different path. Change the first line to match your path:

await dv.view("scripts/views/dv_filter_functions")

Many thanks for the help. Sorry for the long response. Everything works, your table is cool and convenient. As I wrote above, I made a stupid mistake due to my carelessness (instead of “views” there was a “view”), I had previously removed the underscore.

Now back to my original difficult question. Today I added an explanation to topic about the classifier. I think now I managed to describe what exactly I want to do. If you want, I can send the Russian version wherever it is convenient for you.

In short, and keeping the focus only on your table, the task comes down to creating a variable in the FROM field (dv.pages), the value of which is set using a button, which in the worst case calls tp.system.prompt, in the field of which manually enter the hashtag code #UDC/x/x/x, and in the best case, call tp.system.suggester, which shows a hierarchical list of topics in text form (excluding user interaction with the digital hashtag code). It’s true that such functionality is not easy to achieve (the reason for the monstrosity of the diagram), but I think it’s worth it.

In addition, given the logic of your table with the Where field, where the Suggester list is formed based on a summary of all attribute values from all entities that match the value in the FROM field, adding the ability to influence the FROM value will result in filtering of attribute values in the Where fields, which in my opinion will significantly improve the efficiency of your table when you have a large number of entities and a large number of attribute values.

In any case, thanks for the existing table.