Blazor with Blazorise: Select component / SelectItem with delete-button? - select

For my application I need a Select-Component, where I collect some values the user choosed from different sources. But the user should be able to delete values again in the same easy way like adding. The best way would be a SelectItem with a little Button or clickable Badge to delete the value from the list. But whatever I try, nothing works, the Button/Badge is visible, but a click on it is ignored:
<Select TValue="int" Multiple SelectedValues="_selectedWordsForChart" SelectedValuesChanged="#OnSelectedWordsForChartChanged">
#foreach (var word in _selectedCaseWords)
{
<SelectItem Value="#word.WordId"> #word.Word <Button Clicked="#OnButtonClicked">Click me</Button></SelectItem>
}
</Select>
Is it even possible to achieve, what I want, with the Select Component? If yes, how? Can I change the priority of a clicking event, depending if I click on this Button or at the other area of the SelectItem? And if not, what component should I use to get things working? I think, a Delete-Button outside the Select would lead to misunderstandings, what entries should be deleted.
I assume with a datagrid I can match my requirements, but that seems a little ... oversized to me.

Blazorise Select component generates simple <select> and <option> html tags. <option> tag cannot contain any other tags. So it's not possible to add buttons or badges inside the SelectItem. You have to use a different Blazorise component maybe ListView to achieve your goal.

Related

Unity Dropdown shows the first time around, duplicated text

I am having this issue where I have a dropdown that should say finances, inventory, and stats. Which when you click on it will cause other panels of UI to appear. Now for some reason, the options it says it has is all Money:(which is the first item name of the first option). Why is that? I've attached images below that show what I mean.
Sorry about the links i dont have high enough rep yet
Duplicated Text of Money
Another instance of ^
My Tabs
Dropdown Setup
Let's take a closer look at your third and fourth pictures and compare them to the default Dropdown UI element.
So in your third image you show a similar tree but what happened to the Template GameObject? It appears you deleted this and replaced it with the Finances GameObject. This is your primary issue. You can't delete this Template GameObject portion of the Dropdown GameObject. The Template is utilized by the Dropdown code in order to further determine the style of the Dropdown you'll see while in game as well as provide you with a template to look at. I don't know all of the internals of how this works, but I know it for sure plays a roll in your issue.
I know this because now take a look at my Dropdown component. Look at the Template field in mine and compare it to yours. Your's is filled with Finances rather than Template, which is the reason that your Dropdown populates with fields from the Finances rather than the values you are trying to pass it.
Here is what I suggest you do. I'm assuming that the FinancesTab, InventoryTab and StatsTab are all UI elements you want to open upon clicking the respective Dropdown item. If that is the case:
Create a new Dropdown GameObject
Don't delete the Template GameObject within it and leave the Template field in the Dropdown GameObject as is
Add a script that utilizes the SetActive function for each UI element (place them in public fields) to the Dropdown GameObject
Set this code up so that when a certain item on the Dropdown is selected, it sets the desired UI Tab to SetActive(true);
Now reference the new script in the OnValueChanged(Int32) field and reference the correct Method from that script in the dropdown menu in the OnValueChanged(Int32) field.
I believe this should solve your problem and help you achieve what you want. Take a look at the Dropdown API and this Youtube tutorial on Dropdowns if my steps are confusing. You can definitely achieve what you want by following those two links (that's how I figured them out!).
Hope this helps!
Your caption is the gameobject 'Label' so its defaulting that in the dropdown because there are no sprites. I'm guessing Label has a text component that says 'Money'?

tinyMCE - point between block elements

I am using tinyMCE in show block elements mode.
I have written custom plugin that inserts prepared html blocks (layout partials) in actual cursor position.
It's problematic to point a space between two divs.
If I have markup like that:
<div id="first"></div><div id="second"></div>
When I click beteween those divs I would land in first or second div, never between.
So I try to edit html source and result in markup whit br's:
<div id="first"></div><br/><div id="second"></div>
Now I can point between those divs, but it does not work with elements that I add dynamically via tinyMCE. If I add partial eg.
<div></div><br/>
clicking after that div is not posibble. But it's posibble when I edit source manually. Weird. Do you have any solution at this subject?
Tinymce takes care that the user is not able to click between div or p tags.
The reason for this is easy: If a user could click inbetween and he would type in a letter - then there would be another div or p created containing that letter. This is not the way rtes are designed to work. If you want to insert somthing between two divs you will need to use a special button or own plugin to take care of this, but placing the cursor where you won't it to be by hand won't work.

Using a jQuery tooltip plugin to display Custom Taxonomy descriptions

I have a Custom Taxonomy called groups as part of my species Custom Post Type.
On the front-end of my website, each parent Group displays in a box, with a title and a description.
The children of said parent Group then display as single line <li>.
I would like to use a JavaScript plugin to display the description of each of these children when a user hovers over the link. For example, hover over "Hatchetfishes" and see the description for that Group, which might be "All fishes from the genera Gasteropelecidae".
I've had a look at ClueTip and I like the styling/simplicity of the plugin, so if possible, I'd quite like to use that. I'm totally open to using others though, as long as they're based on jQuery and are lightweight.
What would be the most efficient way of doing this? I have 7 parent Groups and 39 children on one page; no descriptions are longer than 20 words.
Thanks in advance,
Within the <li> that holds the children, put the description of the children. Default behavior for these should be to not display, and they should presumably all have the same class. You can then set another class (or just apply css directly with jQuery) to make these display.

jquery hide show

I have a table generated from database ( basically in MVC view). I want to make it editable. I want to use jquery to hide the row when edit button infront of row is clicked and show the row in edit format which is by default hidden. how can I do this using jquery?
Please suggest solution
Thanks
I was able to accomplish this by tagging the table row with a fake class name, then in the button click events I used jquery's Hide/Show. Like this:
In your edit button click event call this:
$('.trMyRowIWantToHide').hide();
And tag your table row with a fake class like this:
<tr class="trMyRowIWantToHide">
JQuery Show
http://api.jquery.com/show/
JQuery Hide
http://api.jquery.com/hide/
You also may want to make use of div tables for this project instead of actual tables. You selectors such as $("#idofcolumn").toggle(); to hide and show the div or in your case you would probably want to show a text field. You could even .html() to replace the text in a column with a text box. There are several ways to go about this. Check out the JQuery documentation.
http://docs.jquery.com/Main_Page
How exactly is the HTML set up for your rows? Normally you could do $('SELECTOR').toggle() on each of them.

How do I select only visible elements using XPath?

I have a GWT application for which I'm trying to write some tests using Selenium.
I'm using XPath to identify the elements on the page for the tests. Using id won't work as the id values are auto-generated by GWT and can change. Things started going well when I realised I could find buttons by their labels as follows:
//button[.='OK']
However, when I started running multiple tests I started having problems. I realised that the issue was all the different "pages" of the GWT app once generated by the Javascript remain in the HTML in hidden <div> elements. This meant my Selenium tests were sometimes clicking hidden buttons instead of the button visible in the current view.
Examining the HTML with Firebug, it seems that GWT hides the <div> elements by adding display: none to their style attribute. This means I can find all the hidden OK buttons as follows:
//div[contains(#style,'display: none')]//button[.='OK']
This will find all the hidden OK buttons, i.e the buttons which have an ancestor <div> which is hidden by having display: none in the style.
My question is: how do I use XPath to find only the visible OK buttons? How do I find the buttons which have no ancestor <div> elements with display: none in the style?
This should work:
.//button[.='OK' and not(ancestor::div[contains(#style,'display:none')])
and not(ancestor::div[contains(#style,'display: none')])]
EDIT:
The simpler and more efficient expression below:
//div[not(contains(#style,'display:none'))]//button[.='OK']
does not work properly because every button has at least one div that's visible in its ancestors.
Selenium 2 Webdriver gives us the option of the isDisplayed() method which deals with this problem. Nice work by the selenium contributors.
This works for me:
//div[not(#hidden)]
//div[(contains(#style,'display: block'))]//button[#id='buttonid']
This worked for me. Like 'display: none' representing hidden blocks, 'display: block' represents currently displayed block and we can specify any inner tags to be identified as above
For me this worked to eliminate hidden elements:
//div[#open]//*
I added this code to the namemapping editor and it did not find the Keep button once it came up. The system sees it in the editor but it doesn't want to click on the button whenever create a new test which will include this item.
Now one other thing this is a dynamic button click so what happens is I will select a button that opens up a to drop downs where I place these items inside those dropdowns. Now it works for the first item but fails to recognize the same mapped item for the next time it is used in another screen. The buttonKeep is the same in both areas.
//div[contains(#style,'display: block')]
This code will find visible element xpath