I have one page where i have about 8 tab region. Each region has a select statment. They are executed when accessing the page (page load) at the same time. Because i have 8 select statment that executes at same time it leads to pure performance.
My question is how to execute the query only on active region.
You can try this one
Create Dynamic Action on event "Page Load"
Create true action "Execute javaScript Code":
window.setTimeout(function(){
$('.a-Region-carouselLink').click(function(){
apex.event.trigger(document, 'tabChanged', this);
})
}, 500);
Set "Fire On Page Load" to "Yes"
Create Custom event "tabChanged"
Create true action in DA custom event "Execute JavaScript Code":
console.log(this.data);
Test it - each time you click the tab, DA prints to console currently clicked anchor.
Of course it is not perfect because of the 0.5s delay. Still it allows you to listen what tab was "clicked".
To make your scenario work I would do:
create page item PX_TAB
create true action in custom event to set value of PX_TAB
create true actions in custom event to refresh reports within tabs
set "Page Items to Submit" to "PX_TAB" in each report to be refreshed
add condition to each report comparing value of item PX_TAB - it will execute SQL query only when PX_TAB has expected value
edit 2016.08.13
You can bind tabs by simple adding listener to the tabs
$(document).on('mousedown', 'a.t-Tabs-link', function(){
//this is an anchor used as tab
console.log(this)
})
If you want to keep it in APEX way enter code from below in Execute when Page Loads page section or create new dynamic action On page load
$(document).on('mousedown', 'a.t-Tabs-link', function(){
apex.event.trigger(document,'tabChanged', this);
})
and then add dynamic action bound to Custom event named tabChanged. Whenever tab is clicked the tabChanged event is triggered, and in Execute JavaScript Code you can reference current tab by this.data
Try to create buttons and set behavior of each button to display required region and hide others (create hidden item, then create buttons that set values 1,2,3 etc., then add conditions to every region to display region 1 only when hidden item equal 1, region 2 for item value 2 etc.
Related
I am using apex 21.1.
I have built a report with a form. The report page(2) has another region "Param" which has item P2_DEPTNO. The form(Modal Page -3) is for creating new records and editing existing records. There is a CLOSE DIALOG process in page 3 and it has P3_DEPTNO as a value for "Items to Return" attribute. Page 2 has a DIALOG CLOSED dynamic action with a true action of SET VALUE that sets P2_DEPTNO with the value of P3_DEPTNO. This is when I should call page 4 in a new tab(when P2_DEPTNO is assigned P3_DEPTNO's value.I am calling page 4 using the code...
apex.navigation.openInNewWindow('f?p=&APP_ID.:4:&APP_SESSION.:::4');
Unfortunately, it does not work and I do not know why. However, if the dynamic action is of type Alert, it works fine and displays the alert when P2_DEPTNO's value changes. What could be the reason for that?
ws=ESLAM_WS
un= forhelp
pwd=Forhelppwd$
app= Call new window
pages= 2,3 and 4
P.S: It works if I change P2_DEPTNO's value manually. But I need it to work when the SET VALUE dynamic action set it's value.
I tried to log in into you app, added another dynamic action event "Execute Javascript code" and entered your code without ':::4' part and it worked well for me.
so:
apex.navigation.openInNewWindow('f?p=&APP_ID.:4:&APP_SESSION.');
(also I have left an alert there that you mentioned worked anyway). If someone else fixed it meantime, I hope she/he will document here what she/he did.
Problem: can't trigger Vue-Select3 item dropdown selection programmatically in unit-tests.
I have tried with both vue-test-utils and #testing-library/vue as well as triggering a click event programmatically in a browser to force list item selection. However, none of these worked. The only way I managed to trigger selection is by getting a VueSelect instance and emitting 'input' event. I also tried to trigger different events on dropdown container, etc.
// Failed
// testing-library
const dropdownItem = getAllByTestId('dropdown-item')
fireEvent.click(dropdownItem[0])
// test-utils
wrapper.find('[data-testid=dropdown-item]').trigger('click')
// In browser
document.querySelectorAll('.vs__dropdown-item')[0].click()
// Success
wrapper.find(VueSelect).vm.$emit('input', payload)
Current result: When a click event is triggered nothing happens.
Expected result: When a click event is triggered Vue-Select should select the item and emit 'input' event.
I found a way of selecting an option directly. You can use the select function of the VueSelect component, like that:
const wrapper = mount(YourComponent)
const vueSelect = wrapper.find(VueSelect)
vueSelect.vm.select(yourOptionToSelect)
That will work if you just want to select a specific option.
But yes, if you want to simulate the click on one of the options, that would not be helpful. And I know that this way of changing the state of a component is not the preferred way of doing this, but it is the only solution I've found.
Please explain how to change a "hidden variable", say p_show_variable, to NULL whenever page is reloaded.
I have a conditional report in a page , and the requirement is whenever any variable changes and that "Submits" the page , then p_show_variable should become NULL, thus hiding the conditional report.
Create unconditional PL/SQL proccess on your Page Rendering. Add some code:
BEGIN
:P_SHOW_VARIABLE := NULL;
END;
You can also add some condition on proccess, for example, Request=Expression. Change button action to Redirect and set Request value. Use this value as Expression in process condition.
Or set condition for proccess When Button pressed and set button name.
Titanium SDK version: 1.7.0
iPhone SDK version: 4.2
I am developing an iOS app using Appcelerator.
In this app I got a window that contains a table of contact data.
The user can click an item in this table and a new window opens up where they can
edit the contact details and then click save.
After the user clicked save I want the table in the parent window to update its data for the clicked row with the info sent back from the edit window.
My question is. How can I update the labels in a specific row if I got the row index?
I am planning to make this update from a custom event so I will not be using e.index only the "saved" index number for example 5.
I know there is a function called "updateRow" but I seem to only be able to update title of the row not its child elements.
Thankful for all input!
Here is the approach I would take.
Assumptions
win1 contains the table (table1) and
an array that contains rows that you
can update (data)
win2 is where the
editing occurs
On the 'save' button click in win2, fire an event with the updated contact details before you close the window;
Ti.App.fireEvent('contact.change' , updatedContactObject );
// Do database save here if required
win2.close();
Add an eventListener in win1:
Ti.App.addEventListener( 'contact.change' , function(e){
var updatedContactObject = e.updatedContactObject;
//
// update the array and the row here
//
data[ updatedContactObject.id ] = updatedRowData;
table1.setData(data);
});
In my experience it is best to tableView.setData(rowArray) whenever you make a change, rather than selectRow, updateRow, etc. Regarding the actual row elements, you should be able to navigate by using row.children[x].children[x]. The problem is that you will have to pay close attention to the hierarchy. Let us know if you find a better way!
Titanium SDK version: 1.6.2 (tried with 1.7 too)
iPhone SDK version: 4.2
I am developing an iPhone app and I am fetching data from my API and presenting it in a table. In this table I got a button on each row that should allow the user to add that person to his or her contacts. The only problem with the code (I think) is that only the last button responds when being clicked. Nothing happens when I click the other buttons.
This is my code: http://pastie.org/1932098
What is wrong?
You are adding the button.addEventListener outside of the for statement, and since you are overwriting the button var with each iteration, the eventListener only attaches to the last button created.
This probably isn't the best way to work this, but to fix your problem, move the button.addEventListener inside the for statement, and then check for a unique identifier in the object that gets sent to the event. Example:
for (x=0;x<5;x++) {
var button = Titanium.UI.createButton({
height:40,
width:100,
top:50*x,
id:x
});
var label = Titanium.UI.createLabel({
text:'LABEL '+x
});
button.add(label);
win1.add(button);
button.addEventListener('click', function(e){
Ti.API.info('Button clicked '+e.source.id);
});
}
The button.id property is just made up, but now you can see which button sends the event. You could also use title, or anything else that is unique.
Other options to look at are creating unique variable names for each button, but that's probably more work. Also, instead of working with putting a button in the table row, use a label or image, then listen for the event generated by the table or row.