This property doesn't show up on Property Inspector - in source just add the property columnResizing="disabled" to the table
Wednesday, December 17, 2014
Thursday, December 4, 2014
Prevent backspace button navigating to previous page ADF
<af:document
id="d1" title="#{apptaskflowBundle.AppName_APPLICATION}">
<af:clientListener method="onloadJSPXPage"
type="load"/>
<af:resource type="javascript"
source="javascript/<javascriptfile.js>"/>
Use the method onButtonPressed() on KeyDown event - To disable backspaceon a component like select one choice
On load event of the document call the method onloadJSPXPage() in javascript.js file to avoid navigating to the previous page
*Thanks! to my colleague Gareth Paglinawan for providing the code snippet
function
onloadJSPXPage(event) {
document.onkeydown = function (e) {
var evt = e ? e : window.event;
var keyCode = evt.keyCode;
var tag = evt.srcElement.tagName;
if
(keyCode == 8){
if (tag == 'INPUT'){
return true
}else{
return false;
}
}
else{
return true;
}
};
//document.onkeydown = onButtonPressed;//or however you are calling your method
function onButtonPressed(event) {
var keycode = event.getKeyCode();
//alert(keycode);
switch (keycode) {
case 8:
event.cancel();
break;
case 46:
break;
default :
break;
}
}
Wednesday, December 3, 2014
Generic Reset input fields ADF
- Pass the component (e.g PanelGroupLayout, PanelForm) to the method to reset all the input fields in it
public static void clearValueInputItems(AdfFacesContext adfFacesContext,
UIComponent component, String id) {
List<UIComponent> items = component.getChildren();
if (0 == items.size()) {
if (component instanceof RichInputText) {
RichInputText input = (RichInputText)component;
if (!input.isDisabled()) {
input.resetValue();
input.setValue("");
adfFacesContext.addPartialTarget(input);
}
} else if (component instanceof RichInputDate) {
RichInputDate input = (RichInputDate)component;
if (!input.isDisabled()) {
input.resetValue();
input.setValue("");
adfFacesContext.addPartialTarget(input);
}
} else if (component instanceof RichSelectOneChoice) {
RichSelectOneChoice rsoc = (RichSelectOneChoice)component;
rsoc.resetValue();
rsoc.setSubmittedValue("0");
adfFacesContext.addPartialTarget(rsoc);
}
} else {
for (UIComponent item : items) {
clearValueInputItems(adfFacesContext, item, id);
if (item instanceof RichInputText) {
RichInputText input = (RichInputText)item;
if (!input.isDisabled()) {
input.resetValue();
input.setValue("");
adfFacesContext.addPartialTarget(input);
}
} else if (item instanceof RichInputDate) {
RichInputDate input = (RichInputDate)item;
if (!input.isDisabled()) {
input.resetValue();
input.setValue("");
adfFacesContext.addPartialTarget(input);
}
} else if (item instanceof RichSelectOneChoice) {
RichSelectOneChoice rsoc = (RichSelectOneChoice)item;
if (!rsoc.isDisabled()) {
rsoc.resetValue();
rsoc.setValue("");
rsoc.setSubmittedValue("");
adfFacesContext.addPartialTarget(rsoc);
}
} else if (item instanceof RichTable) {
RichTable table = (RichTable)item;
if (table.isVisible()) {
table.resetStampState();
adfFacesContext.addPartialTarget(table);
}
}else if (item instanceof RichSelectBooleanCheckbox) {
RichSelectBooleanCheckbox bcheck = (RichSelectBooleanCheckbox)item;
if (!bcheck.isDisabled()) {
Object obj = bcheck.getValue();
bcheck.resetValue();
bcheck.setValue(false);
adfFacesContext.addPartialTarget(bcheck);
}
} else if (item instanceof RichSelectOneRadio) {
RichSelectOneRadio rsor = (RichSelectOneRadio)item;
if (!rsor.isDisabled()) {
Object obj = rsor.getValue();
rsor.resetValue();
if (obj != null ){
rsor.setValue(false);
}
adfFacesContext.addPartialTarget(rsor);
}
} else if (item instanceof RichSelectManyChoice) {
RichSelectManyChoice rsmc =
(RichSelectManyChoice)item;
if (!rsmc.isDisabled()) {
rsmc.resetValue();
rsmc.setValue(null);
adfFacesContext.addPartialTarget(rsmc);
}
} else if (item instanceof RichSelectManyCheckbox) {
RichSelectManyCheckbox rsmc =
(RichSelectManyCheckbox)item;
if (!rsmc.isDisabled()) {
rsmc.resetValue();
rsmc.setValue(false);
adfFacesContext.addPartialTarget(rsmc);
}
}
}
}
}
Subscribe to:
Posts (Atom)