pop up a form on button click in ADF - oracle11g

I am new to ADF and I have 2 views as pics below:
DepartmentsView: which display all departments names, total salary and total No. of employees and have a view button that directs to DepartmentDetailsView.
DepartmentDetailsView: which display department name, total salary and total No. of employees for the chose department and have a button call Add Employee
what i want in DepartmentDetailsView is: when i click on Add Employee button, a pop up form rendered for entering employee data with save button which will update count and total salary without refreshing and hide the employee form after save.
how can i do this in ADF ?

You add an <af:popup> to the DepartmentsDetailPage. The popup holds the form to add a new employee. When you click the save button in the dialog, you update the view that shows the department details via a PPR (Partial Page Request).
You can add the PPR to the form declaratively by adding the save button to the PartialTRiggers property of the form.
Your use case misses some points. When you open the popup the first time, you can create a new row in the employee's iterator. However, you did not mention how to create a new employee once the popup is open.

Related

How to make pop-up data reflect selected record?

The case:
I have Activities as datamodel.
I have set Activities to have many-to-many relationship with themselves to represent a Parent / Child relationship.
I have set up an accordion widget. Each row of the accordion contain basic data about the Activity record + some buttons.
I have set one of the button's onClick functions to open a popup, which allows me to edit the Activity detail in a form.
When I click a different record from the same accordion, the form from the popup reflects the data in the selected record.
The problem:
I have nested accordions which represent the "Child" Activities of the Parent Activity.
I have also added a similar button, which opens a popup. I can open the popup, which targets the child records, but cannot make it open the specific record, from which I pressed the button.
So the popup open by default on the first child.
Please help - how can I make the popup change naturally to reflect the datasource / selected record of even nested datasources?
What I tried:
In order to try and make to popup work I have tried to set the datasource based on the relationship:
Activities: Sub_Activities(relation)
This works to the extent of showing the related items, but popup content does not dynamically change on clicking a different child record or clicking the button from a different child record.
In both cases what is shown is the first child record.
What I understand is that you have a set up in which you click a button and a popup shows. The popup should let you view/edit the record referenced in the row where the button is. If that is the case, then probably you already have almost everything setup for the next thing to work. First, add a string custom property to the popup and name it selectedKey. Then, on the onClick event of the button that opens the popup, add something like this:
var key = widget.datasource.item._key;
app.popups.MYPOPUP.properties.selectedKey = key;
app.popups.MYPOPUP.visible = true;
Now, go to the popup content and add the following on the onAttach event handler:
var key = widget.root.properties.selectedKey;
widget.datasource.selectKey(key);
This is the general idea of how to make it work; However, in order for it to work, your datsources in the widgets should be properly set up. Good luck!

Display user most frequent menus in page

I have a website that it has more than 50 menu items. I want to add a functionality to the website by which, users be able to choose his/her most frequent menu items and add them on the right side of the main page. It can help the user to find links easily.
How can I do this or what's your suggestion to accomplish this in the best way?
Thanks
My Suggestion over this, is Create New SQL table, with Column UserID, and FavMenuItemID.
Create Table userFavMenuItem(
UserID INT,
FavMenuItemID INT
)
Do not forget to add foreign key constraints for both these columns.
So once user choose any Menuitem as Favorite, add a new row and when user want to delete any menu item, delete from this table based on UserID, and FavMenuItemID.
Now, to show Current Favorite menu items on right hand side, Just Get Favorite Menu itmes from this table using UserID.
EDIT
You have to create new page, where user can choose their Fav Menu Item(add/Delete), and also change their previous Fav selection also (at most user can have 5 Fav menu items), and also restrict user to choose only 5

Is it possible to view a specific event in Google Analytics?

We are using Google Analytics to track when a user presses the delete button on our site. The event looks like this:
/*
Category is "User_Images
Action is delete. e.g. they clicked the delete button
Label is "username:bob". So we know it was bob's fault
value is 7. bob deleted 7 images
*/
_gaq.push(["_trackEvent", "User_Images", "delete", "username:bob", 7]);
I can't figure out how to drill down to a specific event. The farthest I can go is to drill down to the summary for a specific user.
But I want to see a specific event. That is, I want to know how many images bob deleted per event. Is this possible?
You can set the secondary dimension (or even primary dimension) to be any of category, action, or label, and then find your specific event. Probably should create a custom report using the c, a, and l as dimensions, and total events as the metric.

Change the NewPage for a TcxPageControl in the PageChanging event

We use a page control to step through a selection process from orders to products. The first tab shows a list of orders, the second tab shows a list of products for the selected order, and the 3rd tab contains a list of properties for the selected product.
If the user choose an order with only 1 product, we want to skip tab 2 and go straight to tab 3 to show the properties of the sole product.
I thought this could be done by setting the NewPage property of the PageChanging event, but it doesn't. What is a better way? To set the ActivePageIndex within the PageChanging event instead?
I would hide the tabs so the user cannot select them at all, and then use a pair of buttons to move back and forth between the pages as needed. When the user is on page 1 and is ready to move to the next page, the button handler can decide which page to show next.

Capturing Select Button on Gridview using jQuery

I have two GridViews that list out included and exclude data items respectively.
By clicking "Change Status" (a custom button for each row) Users can change the row status from included to excluded or vice versa.
However before changing the status - users would need to specify the reason and enter a date for when they want something included/excluded. So these are additional operations that need to take place after the "Change Status" button is clicked and before an update occurs.
I want to use jQuery to capture the row id being "changed", save this value and pass back the update to the database.
I will use an absolute div for the menu but I'm running into issues as to how to capture row id and how to pass this back to my C# in codebehind.
I would have a modal dialog to capture the reason and date when the user clicks the "Change" button. On each row, next to the button include a hidden field that contains the row ID, or better yet the key for the record in the db. Then when you launch your modal, use jQuery to select the hidden field next to the button to grab the key value, and submit it as part of your modal form.
the jQuery would look something like:
$(function() {
$(".changeButton").click(function() {
var rowId = $(this).siblings(":hidden").val();
$("#myModal input[name=rowId]").val( rowId );
// do modal popup
});
});

Resources