http://showcase.omnifaces.org/utils/Ajax
click the AjaxBean tab in the Source code panel on the showcase page (see
below)
import org.omnifaces.util.Ajax;
@ManagedBean@RequestScopedpublic class AjaxBean {
public void update() {
Ajax.update("form:timestamp");
}
public void callback() {
Ajax.oncomplete("alert('Hi, I am the oncomplete callback script!')");
}
public void argument() {
Ajax.data("foo", "bar");
Ajax.data("first", "one", "second", "two");
Map<String, Object> data = new HashMap<>();
data.put("bool", true);
data.put("number", 1.2F);
data.put("date", new Date());
data.put("array", new Integer[] { 1, 2, 3, 4, 5 });
data.put("list", Arrays.asList("one", "two", "three"));
data.put("beans", Arrays.asList(new ExampleEntity(1L, "one"),
new ExampleEntity(2L, "two")));
Ajax.data(data);
Ajax.oncomplete("showData()");
}
public void updateRow(UIData table, int index) {
Ajax.updateRow(table, index);
}
public void updateColumn(UIData table, int index) {
Ajax.updateColumn(table, index);
}
}
On Sep 5, 2014 2:35 AM, "Karl Kildén" <[email protected]> wrote:
> Hi Howard,
>
> Well they use custom ajax so not sure it would be very easy to understand
> but eventually I will look at it yes :-) Still interested in hearing some
> pro input from myfaces guys first
>
> Can you link me the feature in omnifaces? I cannot find it. Regarding
> primefaces I don't want to be to dependent on frameworks as hinted in my
> first email.
>
>
> On 5 September 2014 00:33, Howard W. Smith, Jr. <[email protected]>
> wrote:
>
> > Karl, you could look at PrimeFaces requestContext implementation (source
> > code).
> >
> > also, you can maybe ask for something like this to be added as a feature
> > request in MYFACES JIRA.
> >
> > Is there any reason why you prefer not to use PrimeFaces requestContext
> or
> > the similar feature that is available in OmniFaces library?
> >
> >
> >
> > On Thu, Sep 4, 2014 at 4:30 PM, Karl Kildén <[email protected]>
> wrote:
> >
> > > Primefaces offers several ways to do client side stuff from the server.
> > For
> > > examples see here:
> > > http://www.primefaces.org/showcase/ui/misc/requestContext.xhtml
> > >
> > > While I use primefaces I prefer to keep my hands out of the cookie jar
> > with
> > > stuff like this. I mean a datepicker can be replaced with a js widget
> in
> > 20
> > > minutes if you use a composite component that wraps primefaces date
> > picker.
> > > However this stuff would be painful to replace.
> > >
> > > So my question is, could this be done in some way with JSF or
> > myfaces-impl?
> > >
> > > cheers
> > >
> >
>