EL function closestWidgetVar
See original GitHub issueCurrently you have an EL method resolveWidgetVar(String expression, UIComponent source)
to find a widget var. I would like to have a method to find the widget var relative to the current component, so go up to the root until a component which implements Widget
is found.
I created this method in my project:
public static String closestWidgetVar() {
return Stream.iterate(Components.getCurrentComponent().getParent(),
c -> Objects.nonNull(c.getParent()),
UIComponent::getParent)
.filter(Widget.class::isInstance)
.findFirst()
.map(Widget.class::cast)
.map(Widget::resolveWidgetVar)
.map(w -> String.format("PF('%s')", w))
.orElse(null);
}
It uses Java 9 and OmniFaces, so it needs a bit of rewriting. If you want to I can create a PR for this.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How to find a widgetVar? - Stack Overflow
So, what i am trying to do, is to call the close() method of the selectOneMenu widget var of that previously focused component....
Read more >PrimeFaces JavaScript API Docs
A callback function for a behavior of a widget. ... Only the two properties id and widgetVar are guaranteed to be always ......
Read more >USER GUIDE 5.2 - PrimeFaces
widgetVar null. String. Name of the client side widget. value null. Object. Value of the component than can be either an EL expression...
Read more >JavaScript web_editor widget.Dialog Examples
Class.extend({ saveElement: function ($el, context) { // remove multi edition var ... Dialog'); var weWidgets = require('web_editor.widget'); var options ...
Read more >Intro To PrimeFaces widgetVar - Hatem Alimam
The basics of debugging and knowing what to call and what this function would do is very simple and hard in the same...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
and also introduce closestWidget, which can be reused by closestWidgetVar
Thanks for the PR!