-
Notifications
You must be signed in to change notification settings - Fork 154
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
Suggestion: Run-time evaluated attributes. #130
Comments
Sorry, I see this is already an open issue. #128 |
No worries. I appreciate these comments regardless, because they help me prioritize. Are you aware of splices in attributes? Now that I mention it, I should probably link to that section from "non-empty attributes", since it's not obvious that there's more to the syntax. |
I did look at it briefly, but it appears from the docs that id and class
are special cases and require static lifetimes, and the example uses this
as well so it's not quite clear to me what the possibilities/limitations
are. Ideally I'd be able to use run-time values, ifs etc. But I'll play
around with it!
…On Wed, 23 May 2018, 07:37 Chris Wong, ***@***.***> wrote:
No worries. I appreciate these comments regardless, because they help me
prioritize.
Are you aware of splices in attributes
<https://maud.lambda.xyz/dynamic_content.html#splices-in-attributes>? Now
that I mention it, I should probably link to that section from "non-empty
attributes", since it's not obvious that there's more to the syntax.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#130 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ASXEljIsTcXvGYJQYS7ikXurZEoct32Nks5t1PWKgaJpZM4UJPcX>
.
|
Maybe you have some ideas? Or maybe fleshing out my scenario would help work out what would be a good way to implement it. My incoming data is vector of structs containing row data |
@eedahl The class and id shorthands are no more than sugar around writing out the attributes in full. If they're generated dynamically, then it's okay to use the long form: html! {
tr id={ "lev-" (row.index) } {
// ...
}
} Does this help? |
That does indeed change everything. From the documentation I got the
impression that classes and id's were determined statically only. I may
just be particularly slow, but adding an assurance to the documentation
that runtime code work on id and class tags may be worth doing!
…On Sat, 26 May 2018, 02:07 Chris Wong, ***@***.***> wrote:
@eedahl <https://github.com/eedahl> The class and id shorthands are
merely sugar around writing out the attributes in full. If they're
generated dynamically, then it's okay to use the long form:
html! {
tr id={ "lev-" (row.index) } {
// ...
}
}
Does this help?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#130 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ASXElhWdIavELKNH1hSlmZMdrymPCCUaks5t2JzagaJpZM4UJPcX>
.
|
Closing in favor of #167 |
This may be a non-issue in the current build or there could be a workaround, but I see from the documentation that attributes only accept string literals and .attr with the [] bracket. The program I'm making is primarily displaying tables, and some of the cells/rows have either on-click callbacks prescribed by class/id in JS that depend on the row number (of which there are 50+), and many of the cells have colouring depending on a class attribute (of which there are 7). Obviously, typing these all out and checking a bit for each would be rather cumbersome. From what I can tell so far this is the only thing holding this back from being the perfect templating system for my needs.
The text was updated successfully, but these errors were encountered: