Microsoft Reporting - Only show footer on particular pages - visual-studio

I'm creating a report that generally has two pages. Each is contained within a Rectangle, and PageBreak values are set on these rectangles to make them appear on separate pages.
Also, the second rectangle should NOT have the footer. The simplest solution was to put the footer on every-other page.
THE PROBLEM:
Occasionally the contents of the first rectangle would go to the second page, putting the second rectangle on the third page. In these cases the first two pages needed the footer, and the third page should NOT get a footer.
POSSIBLE SOLUTION:
I see where I can put contingent logic on whether to display content in the footer (The "Hidden" property).
Is there a way to add logic to test for the existence of a particular Rectangle on a page?
Something like this to the "Hidden" property:
=iif ([Rectangle2 is visible], true, false)

I found a solution:
On Rectangle1, in "Properties" set PageName = "Main"
On Rectangle2, set PageName = "NoFooter"
In the footer, on the specific textbox's "Properties", for Hidden enter:
=iif (Globals!PageName="NoFooter", true, false)

You can also use Globals!PageNumber and Globals!TotalPages; if you want to hide footer on the last page you could set its Hidden properties to:
=IIf(Globals!PageNumber=Globals!TotalPages, True, False)

Related

Multi-page header with different content on some pages

I currently have a working multipage report with repeating header / footer. I have implemented page count on footer successfully (eg: Page 1 of 20).
I need to change the header content on pages after the first page (adding "(Continued)" to title):
My Long list of Stuff
Item 1
Item 2
Page 1 of 20
My Long list of Stuff (continued)
Item 3
Item 4
Page 2 of 20
I can't seem to find any way to target only the pages after first. I have experimented with :nth-of-type. Using javascript after page loads to try and access counter.
let hiddenCounter = window.getComputedStyle(hiddenCounterEl, '::after').content;
I suspect getComputedStyle() not supported by PDF Reactor. Any thoughts on how to achieve this appreciated.
EDIT:
The repeating section described above is a part of a larger report so something like below wouldn't work because I wouldn't know the page to start from:
.showonsubqequent { display:none; }
#page :not(:first) {
.showonsubqequent { display:inline; }
}
You can use continuation markers to fulfill use-cases like this. We've introduced them with PDFreactor 11.
With the ::-ro-after-break pseudo-element, you can add generated content to elements after page breaks.
The respective style declarations could look like this:
ul::before {
content: "My Long list of Stuff";
}
ul::-ro-after-break {
content: "My Long list of Stuff (continued)";
}
Please refer to our manual for more information on continuation markers. https://www.pdfreactor.com/product/doc_html/index.html#ContinuationMarkers
While window.getComputedStyle() is supported by PDFreactor, the issue you were observing is a known issue (#8626) and has been fixed in PDFreactor 11.4.4. Prior to that version, only pseudo-element parameters without colons were supported.
Also, please note that nesting element selectors inside of page selectors is not supported by design. This is because applying styles to an element based on the page it is positioned on could change said position in the document.

Link directly to a notebook page in a view

I have an view that extends the current project view, where we add multiple tabs (notebook pages) to show information from other parts of a project.
One of these pages is an overview page that summarizes what is under the other tabs, and I'd like to link the headlines for each section directly to each displayed page. I've currently solved this by using the index of each tab and calling bootstrap's .tab('show') method on the link within the tab:
$(".overview-link").click(function (e) {
e.preventDefault();
var sel = '.nav-tabs a:eq(' + $(this).data('tab-index') + ')';
$(sel).tab('show');
});
This works since I've attached a data-tab-index="<int>" to each header link in my widget code, but it's brittle - if someone adds a tab later, the current indices will be broken. Earlier I relied on the anchor on each tab, but that broke as well (and would probably break if a new notebook page were inserted as well).
Triggering a web client redirect / form link directly works, but I want to show a specific page in the view:
this.do_action({
type: 'ir.actions.act_window',
res_model: 'my.model.name',
res_id: 'my.object.id',
view_mode: 'form',
view_type: 'form',
views: [[false, 'form']],
target: 'current'
});
Is there any way to link / redirect the web client directly to a specific notebook page tab through the do_action method or similar on FormWidget?
If I understood well you want to select the tab from the JavaScript (jQuery) FormWidget taking into account that the id could change if anybody install another module that adds another tab
Solution 0
You can add a class to the page in the xml form view. You can use the id of the element selected by this class name in order to call the right anchor and select the right tab item. This should happen when the page is completely loaded:
<page class="nb_page_to_select">
$('a[href=#' + $('.nb_page_to_select').attr('id') + ']').click()
NOTE: As you have said the following paragrah I assume that you know where to run this instruction. The solution I suggest is independent of the index.
This works since I've attached a data-tab-index="<int>" to each
header link in my widget code, but it's brittle - if someone adds a
tab later, the current indices will be broken. Earlier I relied on the
anchor on each tab, but that broke as well (and would probably break
if a new notebook page were inserted as well).
Solution 1
When the page is loaded you can get the tab list DOM object like this:
var tablist = $('ul[role="tablist"]')
And then you can click on the specifict tab, selecing by the text inside the anchor. So you don't depend on the tab index:
tablist.find('a:contains("Other Information")').click()
I think if you have two tabs with the same text does not make any sense, so this should be sufficient.
Solution 2
Even if you want to be more specific you can add a class to the notebook to make sure you are in the correct notebook
<notebook class="nt_to_change">
Now you can use one of this expressions in order to select the tab list
var tablist = $('div.nt_to_change ul.nav-tabs[role="tablist"]')
// or
var tablist = $('div.nt_to_change ul[role="tablist"]')
Solution 3
If the contains selector doesn't convince you because it should be equal you can do this as well to compare and filter
tablist.find('a').filter(function() {
return $.trim($(this).text()) === "Other Information";
}).click();
Where "Other Information" is the string of the notebook page
I didn't tried the solution I'm giving to you, but if it doesn't work at least may be it makes you come up with some idea.
There's a parameter for XML elements named autofocus (for buttons and fields is default_focus and takes 1 or 0 as value). If you add autofocus="autofocus" to a page in XML, this page will be the displayed one when you open the view.
So, you can try to add this through JavaScript, when the user clicks on the respective link -which honestly, I don't know how to achieve that by now-. But you can add a distinctive context parameter to each link in XML, for example context="{'page_to_display': 'page x'}". When you click on the link, I hope these context keys will arrive to your JS method.
If not, you can also modify the fields_view_get method (here I wrote how to do that: Odoo - Hide button for specific user) to check if you get the context you've added to your links and add the autofocus parameter to the respective page.
As you said:
This works since I've attached a data-tab-index="" to each header
link in my widget code, but it's brittle - if someone adds a tab
later, the current indices will be broken.
I assume that your app allow multi-user interaction in realtime, so you have to integrate somewhere in your code, an update part function.
This function will trig if something has changed and cleanout the data to rebuilt the index in order to avoid that the current indices will be broken.

How to make sidebar menu respond to URLs with parameters?

I define a URL in Slim such as:
$app->get('/dashboard/items?', ....
I then add a link to it in sidebar.twig, and sure enough, it becomes of class "active" once the link is visited.
However, if the URL contains parameters, the link no longer becomes "active".
e.g. /dashboard/items?page=3
I want the menu to recognize that we are still on the same page, and be highlighted as active. Best way to fix that?
Thank you
[UserFrosting 0.3.1]
UserFrosting determines which menu item to highlight by trying to match the current page URL against the URLs in the sidebar menu.
By default, it is configured to compare the entire URL, before any # hashes. To have it disregard your query parameters as well, try having it split the current URL on both # AND ?:
var url_head = url.href.split(/[#\?]+/, 1)[0];
return this.href == url_head;

MVC3: Proper way to ajax update different sections based upon the current layout?

I have the following layout:
ButtonA has a specific left and right side layout, while ButtonB and ButtonC have a common left side but a different right side. My question is how I should determine what needs to updated via ajax when the various Button combinations and their respective Controller/Actions are called?
For example, if the current page is ButtonB and then I click ButtonA (same for current page ButtonA then clicking ButtonB or C) both the left and right sides need to be updated (in this case it would be the entire wrapper div). However, if the current page is ButtonB and then I click ButtonC only the right side would need to be updated. Here are a couple options that might work:
Have a current page layout id and pass that to the controller/action as a parameter. The action would then determine based upon the current layout to either render the right side or both the left and right side. This would work but is it a MVC best practice?
Have the client side ajax know the current page layout and get the left and right side data separately.
Does anyone have any other suggestions or proper ways to do this with MVC?
I'd have something in your content that's in either div.
For exampel
$("#buttonA").click(function() {
var boxA = $(#boxA).find(".myunique");
if (boxA)
... do update
}
Or if it's a matter of what's clicked and not what's in the boxes, then just use global variables:
var lastClicked = "X";
$("#buttonA").click(function() {
if (lastClicked =="A")
... do update
else
... different update
lastClicked = "A";
}

creating sortable portfolio with jquery

I have created the layout for my new portfolio webpage here: http://vitaminjdesign.com/work.html
I want to have a legend with tags (ALL, logo design, marketing, web design, print design) and when these tags are clicked, the page filters the results and display them like they are currently displayed. At first, I want ALL projects displayed, but when the user clicks on a tag (say "print design"), the list is filtered and displayed.
If I have this as my legend: logo
and when logo is clicked, I want all of the div's with the class "logos" to stay and all of the the divs with the other classes to fade out.
What is the easiest way in jquery to make this work. Please note: I am not very experienced with jquery, so please be as thorough and idiot-proof as possible.
First add the classes (logodesign, marketing, webdesign, printdesign) that apply to each project to the div your are assigning the numeric class to.
Then create links that are to filter for each tag like:
Logo Design
Then assign a click event that will hide the others and show the selected one.
var $projects = $('#projects');
$('a.logodesign').click(function() {
hideAll();
showTag('logodesign');
});
function showTag(tag){
$projects.find('div.'+tag).stop(true).fadeIn();
}
function hideAll(){
$projects.find('div.logodesign, div.marketing, div.webdeisgn, div.preintdesign').fadeOut();
}
Although it isnt a direct answer to my question, I found a tutorial on how to achieve EXACTLY what I wanted. It is here:
http://www.newmediacampaigns.com/page/a-jquery-plugin-to-create-an-interactive-filterable-portfolio-like-ours#zip

Resources