how to access Dropdown Menu inside a Navigation Bar using puppeteer? - dart

my code :
final searchMenu = await myPage.waitForXPath('//*[#id="MenuBar1"]/li[4]/a');
searchMenu.hover();
final outClaims = await myPage.waitForXPath('//*[#id="MenuBar1"]/li[4]/ul/li[2]/a');
outClaims.click();
error text :
Node is either not visible or not an HTMLElement.
my code work just fine by selecting the search menu and makes its option visible for the user as in picture1.
picture 1
html code while search menu is selected
html code when the search menu is not selected

Seems to be a problem with your xpath. Try this
//ul[#class='MenuBarSubmenuVisible']//a[contains(text(), 'Out Claims')]

Related

How to get left click to work on column visibility example using the Vaadin Flow Grid example

On the Column Visibility example on https://vaadin.com/docs/latest/ds/components/grid/#column-visibility the code shows a class ColumnToggleContextMenu which isn't part of the Vaadin API however it seems to somehow adjust how the button is hooked so that it can be left clicked rather than the default right click for a context menu. With that in mind the code below will only show the context menu on a right click, I cannot get it to work like the example code. My code is:
Button showHideColumnsButton = new Button("Show/Hide Columns");
showHideColumnsButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY);
ContextMenu contextMenu = new ContextMenu(showHideColumnsButton);
for(Grid.Column column : grid.getColumns()) {
contextMenu.addItem(getColumnName(column), e -> showHideColumn(column));
}
I'm considering using a MenuBar instead to see if that will work but I'd prefer to figure out how to use a Button if possible as that seems more appropriate (mainly because it allows the checkbox to show if a column is visible or hidden).
In order to make the context menu to open on left click use setOpenOnClick(true):
Button showHideColumnsButton = new Button("Show/Hide Columns");
showHideColumnsButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY);
ContextMenu contextMenu = new ContextMenu(showHideColumnsButton);
contextMenu.setOpenOnClick(true)
for(Grid.Column column : grid.getColumns()) {
contextMenu.addItem(getColumnName(column), e -> showHideColumn(column));
}

(Jquery) Search Filter bar show and hide

I need add the functionality to show and hide the Search Filter bar
I tried use (example):
setTimeout(showFilter,5000);
function showFilter(){
alert('showFilter');
$.mobile.listview.prototype.options.filter = true;
$('#workList').listview('refresh');
setTimeout(hideFilter,1500);
}
function hideFilter(){
alert('hideFilter');
$.mobile.listview.prototype.options.filter = false;
$('#workList').listview('refresh');
}
But not working, can you help me ? Thanks
You can hide it with a simple .hide() on the searchfilter's container div. The following code will hide every searchfilter textbox on the page, so if you want to hide a certain subset, you'll have to narrow it down to particular parts of your DOM.
$(".ui-input-search").hide();
Use .show() to bring it back up. Alternately, use .toggle() to switch back and forth between hidden and visible.
(Note: Any text that has been typed into the search box will still apply, even if the search box is hidden.)

Cannot detect Frontpage properly in Joomla 2.5 templates

I've seen in Joomla documentation the way to detect if you are in Frontpage while creating a template in Joomla 2.5. This is the code:
<?php
$app = JFactory::getApplication();
$menu = $app->getMenu();
if ($menu->getActive() == $menu->getDefault()) {
echo 'This is the front page';
}
?>
This works when you are at home page (or clicking on Home menu), but I have an slider in home page, and I link in the slider to an article which is not in any menu item in the application. When I load this article the code above returns as I were at frontpage. I guess that if I doesn't click on any menu item, $menu->getActive() doesn't change.
Any suggestion?
Thanks in advance.
You can do one thing to solve this problem. Create a hidden menu of all the article links which are linked in the sliders.By creating hidden menu the link will be initialized and $menu->getActive() will work for all the links..Hopefully it will works for you .
I wish to add to the present answer and provide some clarifications.
In order for the menu selection to be detected the page requires to be assigned to a menu item. If this is a hidden menu than the link to such a page called My Page would be:
/index.php/my-page - “my-page” is the menu title alias for this item
However, if one wants to show the correct hierarchy in the breadcrumbs for the same page, then the menu hierarchy would have to be replicated in the hidden menu.
For example if My Page is under My Articles main menu item, then in the hidden menu you should add “My Articles” item, of the type: Menu Item Alias, which is in the Systems submenu of the menu type field. The My Page item should be a sub-menu item of My Articles.
The “My Articles” menu item in the hidden menu must have a different menu alias than the same one in the main menu hence the new link to My Page would look like:
/index.php/my-articles2/my-page
To create a hidden menu, one simply creates another menu. It does not matter whether one creates a module for it or not, but if one does then one just should not assign any position to that module.

how to refresh partial view without refreshing the complete page in mvc

I m using a Ajax Tab panel in my application.
There are 4 tabs on Left hand side and a partial view on right hand side.
In each of these tab I m displaying some data and there is a select link button on each tab.
when I click on any of the select link button I m filling the partial view with some information.
When this happens my view is completly loaded again.
A B C D
eg these are the tabs.
let us suppose that I m on tab B and now when I click on the select link button My view is completly loaded with information.
but the tab loose the focus at this point. I comes back to the default value.
so I want help on this
1) either I have to refresh only the partial view without loading the complete page
2) or I need to maintain active tab index value on click on select link button
Please help me with this problem
and provide me examples
jQuery Tabs - Load contents only when clicked
Here is the example which loading content of the tabs dynamically by Ajax. It is for PHP what you need to change is put controller/action instead of URL of the PHP page.
$.get("controller/action", {tab_clicked, "my_tab"}, tab_fetch_cb, "text/json/xml");
or else instead of Ajax.ActionLink
use <a onclick="LoadTab(#item.ID)">Item #item.ID</a>
and jquery function to change the tab and load data dyanamicaly
function LoadTab(id){
//Change tab here Ex: $('#tabs').tabs('select', index);
$.get('ajax/test.html', {Id, id},function(data) {
$('#Partial_Controller_Name').html(data);
});
}
Write an ajax call on click event of tab and load the partial view in the container of the tab
This can be done using RjsResult class
if using mvc1 u can use RjsResult.cs
by this..you can update as many div you want in a page...
use this for implementation
public ActionResult Some_Method(){
RjsResult r = new RjsResult();
ViewData["SomeData"] = Some_Function();
r.update("DIV_id","PartialPagePath",ViewData,ControllerContext);
return r;
}
so when you click on somethink..this function will be implemnted and will refresh you div with tht partial
View part
<div id="DIV_id"></div>
you can update as many dv as you want with a single click :)

jQuery UI, select tab with text link and load link specific ajax content

I am using jQuery UI tabs to have a tab where I can search for records and then other tabs where I can view individual record details. I am trying to have search results link clicks open the relevant tab and load the specific ajax content for that search result.
I am able to switch tabs using an href with something like the jQuery UI tabs example code:
var $tabs = $('#example').tabs(); // first tab selected
$('#my-text-link').click(function() { // bind click event to link
$tabs.tabs('select', 2); // switch to third tab
return false;
});
I see ajax content is normally loaded via setting the href on the tab itself:
<li><a id="customerTabLink" href="#tabs-2"><span>Customer</span></a></li>
I've tried adding this to the my-text-link onclick function to dynamically set the href for the tab but that doesn't load the content in my tab.
$('#customerTabLink').attr("href", "/view/dspClient.cfm?id_customers=15");
Is there another way I can be loading ajax content in the tab without setting this href? Or am I setting the href incorrectly? Is this something I should be using the load even for? http://docs.jquery.com/Events/load
Thanks!
-Matt
To change the URL that tab is using for AJAX calls you should use this:
$('#example').tabs('url', 1, '/view/dspClient.cfm?id_customers=15');
First argument tells that you want to change tab URL. Second argument is the index of the page you want to change the url (zero-based so 1 is the second tab), and third argument is the new URL.

Resources