dashboardHeader allowed elements (tabs) in shinyDashboard - shinydashboard

Any idea how i can add tabs in the dashboardHeader so i can achieve this look found in the shinyapps gallery:
https://gallery.shinyapps.io/TSupplyDemand/

Related

Click on first element contained in a div

I have a div that contains a set of dynamic elements. I want to click on the first search result.
I want to click on the first element contains in
I tried using creating a custom xPath like so but it didn't work. Any ideas here?
//div[1][contains(text(), 'listing')]
First of all It would've helped if you had provided more information.
best will be using pseudo-child like div.firstChild or if the elements are generated dynamically you can add a class and use document.querySelectorAll(".class") which will give you an array of elements that had the class.
You can use array[0] to use click on the first element.
For anyone coming across this thread here is the solution
const listings = await page.$x('//*[contains(#id,"listing_")]')

selenium python how to find and click element that change everytime

im trying to find an element with dinamic values , for example <span class="ms-Button-label label-175" id="id__177">Save</span> in inspect element, the id and class values tend to change for every refresh, how can i in this case find the element in selenium? i tried troguht xpath but seems doesnt work because can not find the path, i was thinking to find "Save" world torught always find by xpath but actually i dont know if im doing well : driver.find_element_by_xpath(//span(#.... but then? how can insert element if it changes everytime? thanks!
Something like this may work:
driver.find_element_by_xpath('//span[text()="Save"]')
But this will fail, if there is more than one button with text "Save" on the page.
In that case you may try to find some specific outer element (div, form, etc.) which does not change and contains the button. Then find the button inside of it.
With few requests with driver:
specific_div = driver.find_element_by_id("my_specific_div")
button = specific_div.find_element_by_tag_name("span") # e.g. there is only one span in that div
Or with more specific xpath:
button = driver.find_element_by_xpath('//div[#class="some-specific-class"]/span[text()="Save"]')
If needed, search for more nested elements before the button, so you can get more narrow search field.
More examples in the docs.

React Native - Position child view above parent's view sibling

I build a textinput like facebook's mentions. After typing # you get a list with different hashtags. I have two of them on one site, one for the title and one for the text.
The problem is, that the hashtag-list from the title is displayed below the text of the content. See Screenshot for that:
The list of hashtags is behind the lorem ipsum content
I tried using the zIndex but it does not have any effect here.
The hierachie is as follows:
View:
-- MentionsText Title
--- #List for Title
-- MentionsText Content
--- #List for Content
As you can see, the content is below the title in the hierachy. That positions it correctly on the screen, but displayes itself above the list of the title. Is there any way of accomplishing it with a smooth solution?
Try wrapping your blocs into views independently, don't use absolute position.
Btw if your list can grow without limit you may need a ScrollView or FlatList.
I found a solution that contains wrapping both textinput in one view, changing the order (content first, then title) and then setting flexDirection of the view to 'column-reverse'. That way the title is again on top and the z-index is now correctly set too. Just doesnt seem very nice, maybe someone got a tip to improve it. The code is the following (note that the MentionsTextInput contains the List as a child):
<View style={{flexDirection:'column-reverse'}}> //The newly added view
<MentionsTextInput //The content of the page
style={styles.inputContent}
placeholder={I18n.t("descriptionInput")}
value={this.state.description}/>
<MentionsTextInput //The title
style={styles.inputTitle}
placeholder={I18n.t("noteTitle")}
value={this.state.title}/>
</View>

The best Xpath option for the below example

Please let me know the best xpath for the below HTML, the button id's are dynamically populated. Hence I tried using the starts-with function as below
driver.findElement(By.xpath("*//button[starts-with(#id, 'j_idt')]")).click();
but, how to achieve if we have two buttons in the same page as per the attached screenshot.
There are multiple ways to find the button. One of the options is to rely on the text inside, e.g. for Login:
//button[span = 'Login']
Then, you can add other checks, e.g. check if it is of type submit:
//button[#type = 'submit' and span = 'Login']

Edit individual radio buttons in zend form view script

I have a zend form which is using a view script. I want to get access to the individual radio button items but I'm not sure how to do so. Right now, I just print them all out using:
echo $this->element->getElement('myRadio');
That prints them all out vertically. I need a little more control. I need to be able to print the first 5 options in one column then the next 5 in a second column.
I have the same issue. There is no nice way to do this that I have found (circa ZF 1.10.8)
Matthew Weier O'Phinney had some advice on this page:
http://framework.zend.com/issues/browse/ZF-2977
But I find that approach cumbersome in practice. The original poster on that ticket had a good idea, and I think they should ultimately incorporate some nice way to do this along those lines.
But since there is no better way at the moment, I just follow Matthew's suggestion for now.
For my form I was working on, to render just one single radio button out of the group, I had to do this:
In my form class:
$radio = new Zend_Form_Element_Radio('MYRADIO');
$radio->addMultiOption('OPTION1', 'Option One')
->addMultiOption('OPTION2', 'Option Two');
$this->addElement($radio);
In my view script, just rendering OPTION1:
echo $this->formRadio(
$this->form->MYRADIO->getFullyQualifiedName(),
$this->form->MYRADIO->getValue(),
null,
array('OPTION1' => $this->form->MYRADIO->getMultiOption('OPTION1'))
);
That will render a <input type="radio" /> element, and an associated <label>. No other decorators will be rendered, which is a pain.
For your case, you will probably want to render your radio elements and other elements using the ViewScript view helper - so you can line all of the elements up amongst your own custom table markup as you described.
Figured this one out too. Just use
$this->element->getElment('myRadio')->getMultiOptions();
and it will return an array of the key/value options.