Get multi-line v-textarea with v-stepper-items - vuetify.js

I have two v-textarea elements. One is shown on step 1 of a v-stepper-items, the other one is shown on page 2. Both shall be rendered multi-line. But only the one that is on the active step when loading the page is multi-line.
I noticed that when I change something in the sourcecode that does not trigger a full page reload, and step 2 is being active at that point of time, the rendered multi-line property will change from step 1 to step 2. So it seems only the v-textarea of the step that is active when loading the page will be multi-line.
How can I force all v-textareas being rendered multi-line, regardless of their v-stepper-items activity?
vuetify 2.6.14

My colleague has found a solution for it. He added a method step () to the view that is automatically called by the stepper when the step / page changed. Also, he added a :key boolean variable called hasUpdated to the <v-textarea> elements. step () now triggers:
this.hasUpdated = !this.hasUpdated
for each <v-textarea> and thereby triggers the correct rendering of the vertical size of also the hidden <v-textarea>.

Related

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 select a specific element inside editor (tinymce 4.x)

I have an image inside the editor using plugin 'imagetools' and added an additional image operation on it (that works fine). After this custom operation is done I'm loosing the selection of the image, that I try to select again.
Since the image is initally selected I would have the chance to capture some information to select it again after custom image operation. But whatever I try it doesn't work:
Before operation (while the image is selected by user):
var node = tinymce.activeEditor.selection.getNode();
After operation:
tinyMCE.activeEditor.dom.select(node);
-> nothing selected
tinyMCE.activeEditor.selection.select(node);
-> Error: Argument 1 ('refNode') to Range.setStart must be an instance of Node
I assume the solution is pretty simple. I just don't get it and tinymce documentation is not really helpful on this.
Found it: You can set a bookmark before doing any changes on or inside the element:
var bookmark = tinymce.activeEditor.selection.getBookmark();
After element processing you set back the bookmark:
tinymce.activeEditor.selection.moveToBookmark(bookmark);
Now your previously selected element should will be selected again.

Reusing a cucumber step definition on a single page Angular app

I'm using watir-webdriver with the page-object gem to drive cucumber tests for a single web page app built in angular js.
The site uses a multiple stage registration process, filling a series of details each time then clicking a 'next' button. (which is enabled when all details are completed for that page)
The issue occurs when I'm attempting to reuse the following step definition:
And(/^I click next$/) do
#registration = RegistrationPage.new(#browser)
#registration.click_next
end
Which calls the page-object:
class RegistrationPage
include PageObject
button(:next, :value => "Next")
def click_next
#browser.wait_while { next_element.disabled? }
next_element.click
end
end
For the first section, the Next button is found correctly, however on the second call to the step definition, the button cannot be found, despite the button being verifiably enabled and otherwise identical.
I see that you've answered your question but in case it helps to explain it to anyone else:
The issue is likely that to watir it isn't the same next button on each page and all of the next buttons are in scope all of the time. Therefore to click the correct one you would have to use the index property of the button you want i.e. index: 1 for the second page and index 2 for the the button on the third page.

Loading default XSLTForms subform on body onload event

I'm trying to use subforms and I had a problem: I saw the example provided in the oficcial XSLTForms but in that case the elements that load/unload the forms are always in the "main form" and, in my case, I need them to desappear, because I'm trying to build something like a wizard, So the first subform must desappear when the user press "Next" and then subform2 is loaded, and so on. This presents two problems:
1) If I include the first subform elements in the "main page", when I press the trigger the elements of subform1 are never unloaded. The other subforms do it, but that initial one is treated as part of the structure that never changes... And I really need to desappear. SO I think I have to put all the content of subform1 outside, in a separate xml and load it in the same way as the other subforms, but there is another problem:
2) I need it be loaded by default, and I tryed to put a load element directly in the main form body, but it didn't work.
I "patched it" temporally with a trigger in the main form, which loads the firms subform, but it is so... ugly, and I still have the same problem: I can navigate through subforms but that initial trigger never dissapears... So, any idea will be welcome! Thanks in advance!
<xf:model xmlns="" >
<xf:action ev:event="xforms-ready">
<xf:load show="embed" targetid="subform" resource="FirstSubform.xml"/>
</xf:action>
</xf:model>

Using a non-repeating frame on the second page of a report

I have an Oracle 10g report that is not functioning properly. I have three repeating frames and one non-repeating frame in the lowest repeating frame with my data elements in it. My issue is that when I have this non-repeating frame on the first page in the layout it works just fine, but, when I slide that frame down with all of the data elements to the second page in the layout it does not work. To reiterate that is all I do, no properties are changed or data elements added or removed, just all current elements slid down to the second page of the layout.
This shows you what I am talking about
Here is the error message
Terminated with error: <br> REP-1814: Report cannot be formatted. Object
'vertically' can never fit within 'M_DEFAULT_MR_LETTER'.
and this shows you how I have the report and static fame properties set
I am hoping that will give you enough information to see if you can tell me what I need to do to fix it.
Change the value of frame: M_DEFAULT_MR_LETTER
Old Value:
Advanced Layout => Print Object On => All Pages
New Value:
Advanced Layout => Print Object On => First Page
with Print Object On => First Page
also you will need vertical elasticity - > variable

Resources