-
Notifications
You must be signed in to change notification settings - Fork 97
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
Static Commands in MarkupControl #928
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is still the problem that the translator does not know that the command invocation will return a promise and thus won't wait for it. It works for the simplest cases when only one command is invoked, but will not work when the command result value would be used in a second step, or so.
…ntrol by execution order planners implemented.
…so for regular bindings.
This issue has been resolved, now the translator wraps the control property invocation result into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, thank you for this patch. Would be nice if you resolve my nitpicks.
We can add support for arguments later (ideally, with the lambdas merged), but I think that is going to be relatively easy.
src/DotVVM.Framework/Compilation/Javascript/JavascriptTranslatableMethodCollection.cs
Outdated
Show resolved
Hide resolved
Nitpicks resolved ;) |
…t it can be handled the same as any other property. Checking for MyCommand == null is now possible. Added a sample with conditionaly hidden button.
I try to use static command as much as possible to make my pages faster. However I ren into a severe limitation. It is impossible to bind
Command
property to static command binding in the markup control.Example:
Let's assume I have
DeviceDetail
markup control used in the page like so:I wanted to implement the
DeviceDetail
control as follows:Code behind:
This use case does not work as it generates client side JavaScript
contetext.$control.Save()
for the save button in the markup control. TheSave
property is not present in the$control
context and attempt to press the "Save" button fails silently.Since markup control properties of type
Command
generate no corresponding property into the$control
client context no control commands can be called from staticCommand binding.We need to correct this.