How can i add an action button into a collectionView's section cell? - swift3

I have a photos collection view with different section header with different items but i want to add an action button into the last cell of a section which will take a photo and will be added the photo to the section cell and only last cell of the section will be contain the action button .I
attached a similar photos of screen in the link below.

#User,
Add action(.touchUpInside) on button in header for all section and while performing events you can detect that if that section is last than perform task otherwise return.
e.g
Add these calls inside view for header in section
section.tempButton.tag = indexPath.section
section.tempButton.addTarget(self, action: #selector(performTask), for: .touchUpInside)
then it will call the selector when touched
#objc func performTask(sender:UIButton){
if sender.tag == lastSection{
//perform task
}
}

Related

APEX - double click on interactive gird

Below is my interactive grid. It shows data from v$sql_monitor view based on sql_id from list .
What I would like to do is to create double-click dynamic action on a record. This action would open new modal dialog and pass two parameters : 1. sql_id from list above 2.sql_exec_id from clicked record. Would you give me a few hints how to do it ? I guess a piece of Javascript code will be necessary :(
There are multiple options to do this - here is one way, by using javascript custom events. I created a sample with an IG on the EMP/DEPT sample dataset with page 88 as IG and page 90 as modal. The column ENAME is a link to page 90 that sets a column value and a page item in the link.
Page 88 has an IG and 2 page items:
P88_PAGE_ITEM (a value entered on the page like the list in your screenshot)
P88_ENAME (to hold the selected report column value
Page 90 has 2 page items: P90_PAGE_ITEM and P90_REPORT_COLUMN
Create IG on page 90 on table EMP
On column ENAME, add the following under "JavaScript Initialization Code"
function(config) {
config.defaultGridColumnOptions = {
cellTemplate: '<button type="button" class="t-Button t-Button--link my-ename-js" data-ename="&ENAME.">&ENAME.</button>'
};
return config;
}
This is a button of type "display as link", created with the universal theme button builder that has 2 extra attributes: a class my-ename-js and a data attribute "ename" data-ename="&ENAME."
Create a dynamic action to capture the click and set the page item:
Make sure to set the scope to "Dynamic". This is needed because the event listener needs to be added again after a dom change (a search or filter of the IG).
add a true action of type "Set Value" to set the value of P88_ENAME to the value of the selected row
add a second true action to trigger a custom javascript event:
Create a dynamic action of type "Event: Custom" to capture the custom event triggered in the previous DA.
add a true action of type "Submit Page". Note that "Show Processing" needs to be unchecked.
Almost there. One last thing is to create a branch to the modal page:
Create a branch (process point "After Processing") with server-side condition of "Request = Value" with value OPENMODAL and link attributes below:
And this should be the result:
Well, I modified a bit your scenario.
I added new SelectList P88_FILTER
and added dynamic action ON_CHANGE :
with action
I modified source if IG:
These changes allowes me to filter IG . In our case filter returns always only one record like below.
and now my problem begins. In your scenario clicking the link "ename" updates field P88_ENAME and opens modal dialog with proper values. After my modification neither P88_ENAME updates nor modal dialog opens :(

How to set modal dialog title dynamically in oracle apex 18

I want to set modal dialog title dynamically based on an interactive element.
ex) In page 50, I've made an Interactive Grid and set the link on "Title" column, when user click on title column, a modal dialog appears.
I want to set the title of that modal dialog to title column's content.
But modal dialog's title doesn't change dynamically.
In this case, how can I apply the titles dynamically?
I've seen many solution related to this question, but I can't solve my problem.
Let's say, your model page number is 51. Here are step by step approach [TESTED] to dynamically change title of model page:
Create a hidden item in your model page, let's say the hidden item name is P51_Title.
In Interactive report -> title column link -> click on link builder box -> set values -> add Hidden item as P51_TITLE under Name and value as '#Title#' Column (#ColumnName#).
In model page 51 static region header (title property), add hidden item value as &P51_TITLE. (dot is mandatory to add at last. This is substitution string with & and dot(.) before and after of item name respectively)
save both the pages and run. when you will click on title column link, the link will be redirecting to the model page and title data will be passed through URL to hidden item in the session, so model page header will automatically change based on title data from report.
I made such dialogcreate js function.
It moves popup page Title to modal dialog title.
So, dynamic calculated title &P51_TITLE. would be applied automatically.
$(document).on("dialogcreate", ".ui-dialog--apex", function(e) {
var lDialog = $(this);
lDialog.find('iframe').on('load',function () {
lDialog.children(".ui-dialog-content")
.dialog("option", "title", $(this.contentDocument).find('title').html());
});
});
I am very disappointed that something like this (or any other solution) do not work in apex modal pages by default!

ActiveAdmin Register Page Batch Action

I have Custom page "All Posts"
Can i integrate batch action into this custom page for assigning the post to a particular category
ActiveAdmin.register_page "All Posts" do
menu :priority => 1#, label: proc{ I18n.t("active_admin.dashboard") }
content do #title: proc{ I18n.t("active_admin.dashboard") }
#how can i put here a batch action
end
end
how can i put here a batch action as it gives errors when i write the batch action for resource code.
should i write the page_action and then customize it using javascript and partials.
Thanks in advance
You can try to add batch_action by
batch_action :export do |selection|
keys = Model.find()
redirect_to admin_path_to_page_with_category_selection_path(post_ids: selection)
end
and selectable column
index download_links: [:xlsx] do
selectable_column
.....
end
admin_path_to_page_with_category_selection_path goes to view with category combobox, selected posts and submit button

Reload Isotope "Show all" filter after showing hidden div

I have made a collapsible section for the portfolio (extensive) gallery on my one page website. The gallery has Isotope filters applied to it. On default only the header is shown, but when clicking on the header, the filter names and gallery should be unhidden (content hidden via CSS using display:none) as per JQuery code below:
$(document).ready(function () {
$('h5').click(function () {
$(this).toggleClass("open");
$(this).next().toggle();
}); //end toggle
}); //end ready
When I click the header, it expands the filter names, but gallery content isn't displayed. This only happens after clicking one of the filters. When toggling the collapsible section, the gallery remains shown as intended.
So the only problem is the initial unhiding of the gallery. I think by clicking the header, the "Show all" filter or other relevant div has to be reloaded/refreshed in order for the gallery to appear. I've tried multiple commands, but can't seem to find the correct one.
Thank you for the help and let me know if you need any more information.
Apologies for the delay, but please find setup via link below:
http://www.davidmaes.eu/#work
Thanks for the help.
I took a look at the site and isotope doesn't have time to calculate the image sizes, so it's giving the UL container a height of 0: <ul class="portfolio-wrap isotope" style="position: relative; overflow: hidden; height: 0px;"> which is why the images aren't showing up.
When the user clicks a filter, isotope recalculates the images sizes and applies it to the UL, and voila, the images reappear.
You can manage this by using the imagesloaded script, which will only call isotope once the images have finished loading.
Here's the isotope documentation on integrating isotope with imagesloaded.

Use a button to navigate to a different tab

My app has four tabs. The root view controller of the first tab (index zero) is where the log in page pops up as a modalviewcontroller, but a view controller in the fourth tab (index three) is where the log out button is. Is there a way to programmatically set it so that when the logout button is pushed the app transitions to the tab at index zero? I initially tried a push transition, but that made the root view controller of index zero instead show up as a view controller in index three.
If you want to programmatically change the tab, just call
[self.tabBarController setSelectedIndex:index];
In your case create the selector, which will be assigned to the logout button event.
- (IBAction) didClickLogoutButton:(id)sender {
// do some work to log out the user...
[self.tabBarController setSelectedIndex:0];
}
Hope this is what you meant.