How to switch to a new tab - smartgwt

I currently have a TabSet of tabs.
List<Tab> tabList = new ArrayList<Tab>();
tabList.add(createTab("tab1", "Tab1", new TabPanel()));
tabList.add(createTab("tab2", "Tab2", new TabPanel()));
TabSet tabSet = new TabSet();
tabSet.setTabs(tabList.toArray(new Tab[tabList.size()]));
I want to be able to add a double click handler in a grid, by double clicking something, it will switch to one of the tabs Im not currently on. How do I achieve this?

In your click handler call selectTab() on the tabSet. Just pass in either the zero based index of the tab, the string id of the tab, or the particular Tab instance.

Related

Dynamically add sub menu items to tray icon context menu

I have a tray icon with a context menu, it has several predefined items (js array of objects)
One of the options is defined as follows
{
id: "MyItem",
label: "MyItem Label,
submenu: []
}
For some reason, when I populate the submenu with menu items, they don't appear in the tray icon context menu >>MyItem>>submenu (it remains empty), I do see the JS object being updated properly with the right values (
submenu>>items are populated with MenuItems)
I try to append them like this (but they are not reflected in the tray icon):
let MyItemElm = contextMenu.getMenuItemById("MyItem");
MyItemElm.submenu.items.push(new MenuItem(item1));
MyItemElm.submenu.items.push(new MenuItem(item2));
When I try to push the same item1/2 to the ROOT of the context menu it does work, like this:
contextMenu.insert(8, new MenuItem(item1))
contextMenu.insert(8, new MenuItem(item2))
Any ideas on what am I missing here?
solved it by using the following:
let MyItemElm = contextMenu.getMenuItemById("MyItem");
MyItemElm.submenu.insert(0, new MenuItem(item));

Playwright - how to switch to new tab and then to frame

I have below scenario -
Launch browser and do some operations
Click on a button, a new tab opens
switch to new tab.
In new tab, switch to iframe and perform
operations inside frame.
How can I handle this in playwright? Once I switch to new tab, all elements are inside frame, so I want to switch to new frame after switching to new tab
Note - Frame doesn't have name. I can use xpath to identify frame.
will page.frame("xpath to iframe") work?
If anyone can provide small code snippet, would be really helpful.
I Tried using page.frame("xpath locator to iframe") - but not working
You can switch to the new tab like this.
const [newTab] = await Promise.all([
page.waitForEvent('popup'),
page.locator('your locator here').click(),
]);
await newTab.waitForLoadState();

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));
}

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

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')]

Opening Kendo popup window for adding new records

I have an separate Add button (neither on toolbar, nor on grid) and I want to open a popup window (having some fields) after clicking this button in order to create a new record. I have a look at the Kendo Demo pages, but all the samples use grid's or toolbar's Create button. Instead of them, a need a sample with a separate button. Any sample please?
Update: I want to create a listview as shown below instead of grid:
If you call dataGrid.addRow() method and edit mode is set to "popup", Popup window will be displayed.
Look at this dojo

Resources