Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dataview query inside the field #107

Closed
dxcore35 opened this issue Jul 6, 2023 · 7 comments
Closed

Add dataview query inside the field #107

dxcore35 opened this issue Jul 6, 2023 · 7 comments
Labels
duplicate This issue or pull request already exists feature request New feature or request

Comments

@dxcore35
Copy link

dxcore35 commented Jul 6, 2023

I would like to type something like:

INPUT[suggester(dv.pages().where(b => b.class === 'needs').sort(b => b.date_created, "asc")):needs]`


This suggester should be filled with filenames coming from this dataview query.

Here is the very tiresome work around with dataviewJS:


const setFilter = "" ;
let filter = "Need | "
const pages = dv.pages().where(b => b.class === 'needs').sort(b => b.date_created, "asc")
let list = []

for (let items of pages) {
	list.push('option(' + items.file.name + ')')
}


// This is the Mermaid configuration.
const codeblock = "INPUT[suggester(";
const backticks = "`";

await dv.paragraph(
  `${filter}${backticks}${codeblock}
  ${list}):needs]
  ${backticks} 
  `);

But there is a glitch, for good few seconds I see this:

Screenshot 2023-07-06 at 13 30 09

Before the select button renders correctly.

@dxcore35 dxcore35 added the feature request New feature or request label Jul 6, 2023
@mProjectsCode
Copy link
Owner

mProjectsCode commented Jul 6, 2023

Please see #103

@mProjectsCode mProjectsCode added the duplicate This issue or pull request already exists label Jul 6, 2023
@dxcore35
Copy link
Author

dxcore35 commented Jul 7, 2023

It doesn't explain why there is a glitch I mentioned above, that for good few seconds before the meta-bind button is generated there is just text.

@mProjectsCode
Copy link
Owner

it seems like the parser has some strange problem with the line breaks in the input field declaration.
Try changing your last line to

await dv.paragraph( `${filter}${backticks}${codeblock}${list}):needs]${backticks}`);

@mProjectsCode
Copy link
Owner

Correction, it seems like dataview is doing some fancy predictive rendering and reactive evaluation of the querry, which reevaluates the script and potentially breaks the input fields

@mProjectsCode
Copy link
Owner

This is something that dataview does and i have no influence over it, so i can't fix it.

@dxcore35
Copy link
Author

dxcore35 commented Jul 8, 2023

For example im generating with dataviewJS:

  • mermaid diagrams
  • heatmaps

Non of those generate first text and then the GUI. So I think there is something in meta-bind plugin that is doing it. Please check.

@mProjectsCode
Copy link
Owner

Closing this for now. In the next release, you will be able to build the input field using js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants