Handling Browser compatibilties with ADF - oracle-adf

I am trying to capture keypress event for "ENTER" key for input box inside ADF editable table. I have added client listener and server listener and have the JavaScript code for the input box inside af:resource tag.
The requirement is as follows -
I have a editable table with total of 6 columns but only first and last columns are editable. So when user enters a value in first column and hits enter I need to populate some data from some other business component and fill the other columns.
I am able to capture the enter keypress event, but when I am using chrome after the server side method is called the row focus is automatically moved to next row in the table.
Can someone tell me how to stop this on the table. This happens only in chrome. The code works fine in firefox and IE.

You could set focus on the field you need through javascript on request. But you need to know the client Id of the component to set focus on.
Call this in your event handler:
String clientId = ...
String script = "AdfPage.PAGE.findComponent('" + clientId + "').focus();";
FacesContext context = FacesContext.getCurrentInstance();
Service.getRenderKitService(context,
ExtendedRenderKitService.class).addScript(context, script);
script will be called on the client when response is handled.

Related

Printing reports with APEX Office Print on a master detail page

I have created a new blank page with: interactive grid, items and button print with dynamic action for APEX Office Print plugin with SQL Code and it is printing my reports the way I wanted.
But, I want to do the same exactly thing inside my master detail page. When I enter my detail form I want to have a button "print" with the same action for printing that report. I have done the same thing (like on the "blank page") on my master detail form (added new button print with dynamic action and SQL Code and connected it with my primary key) but it is not working, it is printing blank reports.
What am I missing here?
Add another item with the same value (P_ID) which gets submitted. Then add new button print with dynamic action and SQL Code and connected it with that new item you have created.

ExtJS synchronize record between clients

I'm trying to do something fun: I'd like to send the record changes from one client to another and have the second client updated to show these changes. Basically collaborative viewing. The second client is disabled from making changes, he can only watch.
Simple fields like strings, numbers, checkboxes, etc. are easy, that worked right away.
The references are the problem. If I have a combo that uses another model as it's source, I am unable to update it on the second client.
I tried setting just the id, then the entire referenced object, I tried various set options, but simply no dice.
The record does change, I see that the data is updated, I was even able to manually modify the _ reference attributes, but the UI keeps showing the old values for those fields.
Is there a way to send the record from one client to another and have the other client just take over all values and display them in the UI? (it would be better to send just the changes, but I'd be very happy if I could get it to work with the entire record)
EDIT: I'm using SailsJS with socket.io, so the p2p connection is not the issue.
I'm getting the data like this:
var data = record.getData(true);
broadcastRecord(data);
And on the other side I tried:
record.set(data);
A code example for the receiving side would be appreciated, if anyone has an ide how to solve this...
I think your problem is related to associations and comboboxes.
Let's say you have a model User with a field group that references model Group, and that you have a User form with a Group combobox.
In the receiver client, you are probably getting only the group id. record.set(data) updates the bound combobox calling setValue(groupId).
This setValue will try to find the corresponding record inside its store, but it won't ask server-side for that record. Instead, it will create a new record with the passed id (showing an empty combobox).
If possibile, you can set remoteFilter:false to the store and queryMode:'local' on the combobox and preload all the data from that store.
Otherwise, I think you'll have to override the combobox setValue method to get the record remotely.

How to send data to backend when dropdown selected in zapier

Hello I have been trying to implement my app to zapier. I am able to authenticat through oauth2 and calls are going well but I am not able to pass data to back end when I use combobox.
I created two trigger
1) First trigger doesn't have trigger field, just a polling URL which fetch data from server and set variable. It works as expected. It sets data to lets say variable "X"
2) Second trigger is basicly for using "X" I have one trigger field "Y" which is combobox and as documentation I just write X.id.name and I can see combobox with field. I want to implement combobox selected event. I implement polling url like this http://mywebpage.com/myapi/{{Y}} . But whenever I test my zap , lets say I choose id = 5. it always request http://mywebpage.com/myapi/{{Y}} but not http://mywebpage.com/myapi/5 how can I solve it.
Thanks.
Ok I found the fix. I needed to change second trigger type to Unicode, because this way I can get selected one. Now is working.

MS Access keep ID field in subform filled with ID from parent form

Everytime I jump to where I can enter e new record, the ID field from the parent is empty and so the connection is lost. I am looking for a workaround.
My Setup
I have a parent form that deals with two 1:n relationships
(school-class --> pupils, school-class --> tests).
For the first relationship I used the wizard. Everything works find. For the second I show the connected tests in an unbound list. Under the list is a button opening the form for entering a new record (test) for the class I came from (parent form). So I filter the sub-form via VBA so that only the tests of the current class are shown. That works perfectly fine, too.
When moving through the tests already connected with the class the correct ID (of the class filtered) is the value of the corresponding input field. But when I come to the new new record state (all fields empty), then the connection to the parent breaks and the user has to manually enter the ID of the parent (school-class).
My Question
Is my setup correct?
Is there a better way to create a subform that offers to (only) enter a new record connected to the parent data? (Maybe without the ID input field in the subform and passing of forcing the value via VBA?)
Thank you for your time!
You can use Default Value to set the classid of Tests form but be sure the parent form is open in background or behind the pop up.
Under Property Sheet/Data tab of Tests form's classid control, enter in Default Value cell:
=Forms!parentformname!classid
Alternatively, in VBA in the Tests form's OnOpen Event:
Me.classid.DefaultValue = Forms!parentformname!classid
You can then choose to hide (Visible - No) this classid control so users do not modify it. It's always advised to never allow users control of primary and foreign keys.

ZK window not unique in ID space

In our project we use ZK for webpages. There is a combobox which has lists. When selected, it fetches data from a java object through onSelect, i have given the logic.
when i select one there are 4 listboxes on that page to be filled with data according to the selection. when i select first time, no problem occurs.
But on second time i get an error pop-up like "Not Unique in the id space of Window" and showing the list box item id which have to be filled on select.
Can any one help out there?
Note: Though it shows this error i get the listboxes filled correctly according to the combo box selection. Still i cant stop this error occurring..
Your issue is a conflict of ids in ZK's id space.
A bit of background..
ZK generates ids for components at runtime, if you open up the DOM in the browser you'll see each component has some machine readable id.
However, you can also give components an id. This id does not go to the DOM but lets you reference the component in your application.
These two shouldn't be confused. The conflict you're experiencing is with the latter type of id; you are assigning a component an id in your Java code or in your ZUL file which, at runtime, is not unique.
The case you describe where it only happens the second time you click is a tell tale sign here. The content you are adding on the event has an id defined in it and you are not removing this content when you are done.
Consider the following example:
#Wire
private Window myWindow;
#Listen(Events.ON_CLICK + " = #myButton")
public void onMyButtonClicked() {
Label myLabel = new Label("sean is cool");
myLabel.setId("myLabel");
myLabel.setParent(myWindow);
}
This will work the first time you click myButton, but will throw your error on the second click. That is because the second event tries to add myLabel to myWindow but there is already a myLabel there.
There are lots of ways to resolve this depending on what you are trying to do.
Have a look through the ZK documentation on ID Spaces for more.
I also faced the same error.
My scenario is the same, only the widgets being used are different.
Hence putting my workaround here.
I have put the following piece of code in the doBeforeCompose() method of the composer:
Component widgetWithId = page.getFellowIfAny("widgetWithId");
if (widgetWithId != null) {
widgetWithId.detach();
}
Here widgetWithId is the component/widget, which is tried to be regenerated by the code, with the same Id and ZK is throwing error for it.

Resources