What are the possible ajax events for a primefaces InputText? - ajax

What are the possible events that I can have in there? thank you :)
<p:inputText>
<p:ajax event="" />
</p:inputText>
Tried looking at List of <p:ajax> events but the documentation doesn't have a list of the possible events for each component :p

As Primefaces 7.0 InputText extends HtmlInputText but does not override getEventNames() method, you can find them here.
"blur","change","valueChange","click","dblclick","focus","keydown","keypress",
"keyup","mousedown","mousemove","mouseout","mouseover","mouseup","select"
In order to easily get all the event names, you can simply use the javax.faces.component.UIComponentBase.getEventNames() method on a component instance:
import javax.faces.component.UIComponentBase;
public class SomeTest {
public static void main(String[] args) {
dumpEvents(new org.primefaces.component.inputtext.InputText());
dumpEvents(new org.primefaces.component.autocomplete.AutoComplete());
dumpEvents(new org.primefaces.component.datatable.DataTable());
}
private static void dumpEvents(UIComponentBase comp) {
System.out.println(
comp + ":\n\tdefaultEvent: " + comp.getDefaultEventName() + ";\n\tEvents: " + comp.getEventNames());
}
}
Output for PrimeFaces 7.0:
org.primefaces.component.inputtext.InputText#239963d8:
defaultEvent: valueChange;
Events: [blur, change, valueChange, click, dblclick, focus, keydown, keypress, keyup, mousedown, mousemove, mouseout, mouseover, mouseup, select]
org.primefaces.component.autocomplete.AutoComplete#72d818d1:
defaultEvent: valueChange;
Events: [blur, change, valueChange, click, dblclick, focus, keydown, keypress, keyup, mousedown, mousemove, mouseout, mouseover, mouseup, select, itemSelect, itemUnselect, query, moreText, clear]
org.primefaces.component.datatable.DataTable#614ddd49:
defaultEvent: null;
Events: [rowUnselect, colReorder, tap, rowEditInit, toggleSelect, cellEditInit, sort, rowToggle, cellEdit, rowSelectRadio, filter, cellEditCancel, rowSelect, contextMenu, taphold, rowReorder, colResize, rowUnselectCheckbox, rowDblselect, rowEdit, page, rowEditCancel, virtualScroll, rowSelectCheckbox]

Related

Xamarin DataPicker how to handle done button click event

I added to my DataPicker unfocused event. And in this event I would like to check if Done button was clicked.
private void DatePicker_Unfocused(object sender, FocusEventArgs e)
{
}
Or other option.
Is it possible to add listener to button Done, and if was clicked then fired some method?
How can I do it?
Thank you.
Every UI control which receives input always has some event handlers which you can listen to.
In your case the DatePicker has an Event Handler which fires when the Date property changes.
Here is the documentation:
DatePicker Event Handler - Xamarin Documentation
The implementation of this handler is simple:
DatePicker datePicker;
DateTime newDate;
DateTime oldDate;
public YourPage()
{
datePicker.DateSelected += Date_DateSelected;
}
void Date_DateSelected(object sender, DateChangedEventArgs e)
{
newDate = e.NewDate;
oldDate = e.OldDate;
}
Always read the documentation first, as that's the best way to learn how to use a specific control.

How to delegate event processing from CellList / CellTable to cell's widget in GWT?

Is there a way to process click event in cell's widget?
I implemented custom complex cell with text and image. Wrap it with FocusPanel and declare a click handler. But CellTable and CellList intercept all events.
There is a way of doing it directly, no wrapping:
table.addCellPreviewHandler(new Handler<MyObject>() {
#Override
public void onCellPreview(CellPreviewEvent<MyObject> event) {
if ("click".equals(event.getNativeEvent().getType())) {
// do something with a click, using event.getColumn(),
// event.getIndex() and event.getValue() as necessary
}
}
});

GWT: Event fired multiple times onClick

I need to get an event fired after clicking on a grid cell. It works but fires multiple events.
My Code:
private void gridClickHandler(final boolean cardDeterminer) {
gridClickHandler = new ClickHandler() {
#Override
public void onClick(ClickEvent event) {
int cellIndex = view.getGrid().getCellForEvent(event)
.getCellIndex(); // get clicked cell of grid
if (cardDeterminer)
oasisCardRPC(cellIndex); //rpc based on clicked cell
else
desertCardRPC(cellIndex); //rpc based on clicked cell
}
};
view.getGrid().addClickHandler(gridClickHandler);
}
The method gridClickHandler is called in an onSuccess of a RPC and calls a new RPC using a boolean passed. (it works like this: click on some widget, when success then click on grid. Grid should only fire event, when this some widget was clicked directly before)
I don't know how to create a new ClickHandler only once for the grid and still make its clickHandler only fire events, when needed.
Thanks in advance!
Use a boolean : isClickHandlerAttached
Initially false, first time you add the clickhandler put it on true. Only attach if boolean is false.

GWT Propagate event through AbsolutePanel

I have a CellTable with ClickableCell. When I click on it, a popup opens and show the clicked cell table as exepected. The CellTable is added in a AbsolutePanel(Parent).
For some developpment, an another AbsolutePanel(Over) is located over the CellTable.
How can I propagate the AbsolutePanel(Over) click event on the celltable ?
I had an handler on the AbsolutePanelHandler(Over) and fired the clicked event :
absolutePanelOver.addDomHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
NativeEvent nativeEvent = Document.get().createClickEvent(0, -event.getScreenX(), event.getScreenY(),
event.getClientX(), event.getClientY(), event.isControlKeyDown(), event.isAltKeyDown(),
event.isShiftKeyDown(), event.isMetaKeyDown());
DomEvent.fireNativeEvent(nativeEvent, cellTable);
}
}, ClickEvent.getType());
Unfortunately the popup cell table is not shown. But I know that the cellTable handles the event.
Regards
Maybe I did not understand your question, but the solution seems to be much simpler.
absolutePanelOver.addDomHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
doSomething();
}
}, ClickEvent.getType());
In your CellTable you invoke the same doSomething() method when a cell is clicked. Now it does not matter whether a cell or an absolute panel is clicked - the same method will be executed.

Where Can I Find Key Events in LightSwitch?

I'm working on a project in Lightswitch and I'm trying to handle the keyup event on specific screen
I couldn't find it, where can I find those events (such us KeyUp KeyDown LostFocus ext. )
and if they are not supported what should I do to handle a situation like that?
I guess you are referring to controls and not the actual screen. So, for example, to handle keyboard events on a textbox, one way of achieving it is like in this example, where I have an "Address1" textbox and I want to change its text whenever the user types a certain letter:
1 - On the Activated event of the screen, you can get to the required textbox:
partial void CustomersListDetail_Activated()
{
this.FindControl("Address1").ControlAvailable += AddressTextBoxAvailable;
}
2 - On the Available event handler, you can connect with the required event (you can have KeyUp, KeyDown, LostFocus and others):
private void AddressTextBoxAvailable(object sender, ControlAvailableEventArgs e)
{
((System.Windows.Controls.TextBox) e.Control).KeyUp += AddressTextBoxKeyUp;
}
3 - On the KeyUp event handler, you can do your manipulation:
private void AddressTextBoxKeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.A)
{
((System.Windows.Controls.TextBox) sender).Text = "You typed A";
}
}

Resources