-
I have a somewhat weird issue that inputs table aren't rendered where I want them to be rendered. At the same time I am almost sure, I am doing something that I shouldn't do. Here is my setup
/* SELECTORS */
const dateArray = getUnique(teamData, "Date"); // >> creates flat a flat array with values
const marketArray = getUnique(flowMetricsData, "Market");
const dateSelector = Inputs.select(dateArray, {
value: dateArray[dateArray.length - 1],
format: (f) =>
formatDate(f, {
options: {
dateStyle: "medium",
},
}),
label: "Date",
});
const marketSelector = Inputs.select(marketArray, {
value: "defaultValue",
label: "Markets",
});
const selectedDate = view(dateSelector);
const selectedMarket = view(marketSelector); Now, this obviously would render the selector outside my HTML structure, and I am sure the issue is here, but I don't know what else to do.
<div class='dashboard'>
<header>
<h1>Make Work Flow - Global View</h1>
<div>${view(dateSelector)}</div><div>${view(marketSelector)}</div>
</header> Note: I do not fence the HTML block, as this has strange behaviour when using
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You could use https://observablehq.com/framework/lib/generators In a given code block (you don't need two different blocks here, although you can use two if you prefer): ```js
const dateSelector = Inputs.select(dateArray, {
value: dateArray[dateArray.length - 1],
format: (f) =>
formatDate(f, {
options: {
dateStyle: "medium",
},
}),
label: "Date",
});
const selectedDate = Generators.input(dateSelector);
``` this binds the Then in markdown, display the selector: <div class='dashboard'>
<header>
<h1>Make Work Flow - Global View</h1>
<div>${dateSelector}</div>
</header>
</div> In essence, |
Beta Was this translation helpful? Give feedback.
You could use https://observablehq.com/framework/lib/generators
In a given code block (you don't need two different blocks here, although you can use two if you prefer):
this binds the
selectedDate
variable to the value of thedateSelector
selector.Then in markdown, display the selector: