Maintain scroll position and dynamically update the list of options - react-select

I want to dynamically update the list of options without forcing the dropdown to be in a loading state. I can get this to work, but the when the options are updated, the scroll position of the dropdown is reset to the default state (if it was open)
Is there a best practice for this use case?
My current thinking is that I should maintain the scroll position and refresh it once I update the list of options if the dropdown is open, but hoping there is a simpler solution.

Related

How Do I Expand A Cell in MUI-Datatables to display additional content?

I want a user to be able to click a row in the MUI-Datatable, so they can see additional content. The current renderExpandableRow function has the right styling, but I don't want a new row. I want the cell in the first column to show additional data. Is there a way to do this?
Note: I'm also going to need buttons that will expand all/collapse all, so I need a solution flexible enough to do that.
I found a solution to my question.
I made the first column's content a Button using customBodyRender. The column with expandable content became the second column. This column has a customBodyRender with a Collapse component. I store in my component's state all ids of my data objects and whether or not they are expanded. When the Button is clicked, my component's state is updated, which in turn changes whether or not the Collapse component is open.
I also used customToolbar in the table options to generate an expand all/collapse all button, which just sets the state of all rows to expanded/collapsed.

How to disable multi-select behavior on touch-devices in cytoscape.js?

For cytoscape.js 2.0.[0-1], on touch-devices, by default, as you click on nodes/edges, every one of them gets "selected" -- causing multiple-selections as user taps on different elements within the network. Is there an option to prevent this behavior so that every tap selects the target element and unselects the rest?
I don't think so, but we will add one:
https://github.com/cytoscape/cytoscape.js/issues/290

Arrow keys don't work after programmatically setting the selected item in a listview

I have a listview with some things in it, and I have a sub that will refresh the listview by deleting everything in it and re-populating it.
However, when the user selects an item and the list refreshes, I wanted to have that same item select itself once more. I accomplished that by doing:
ListView.Items(4).Selected = True
ListView.Select()
which selects the 5th item in the list view (counting 0). However, when the user presses the up or down keys, the selected item jumps back up to the top item in the list, and I can't find a way around this.
The only search that has come up with anything is here:
Arrow keys don't work after programmatically setting ListView.SelectedItem
But I do not understand the responses, I need a dumbed down version or a simpler solution if possible, thank you.
Try using the Focused property on an Item. Seems like I may have run into this before.
ListView.Items(4).Focused = True
You may also need to set that same property to False for the first item in the list.

How to edit Expression Blend selected control part?

I am trying to edit a specific control part within a custom TabItem Template. In this case, it's the TemplateBottomSelected control part.
I'm having an issue where I cannot seem to view or edit any control parts within the template editor except the default TemplateTopSelected. Here's a screenshot of what I'm talking about:
Even though I'm selecting the "TemplateBottomSelected" grid, the only thing I can see is the template for the TemplateTopSelected item.
How the heck do I edit the other control parts within the template using the editor?
Thanks!
that's because these templates are either collapsed or the opacity of them is set to 0. :)
you can use the eye toggle button to only show the one you want to modify at design time, set the visibility to visible, do your changes, and reset it to collapsed.
please let me know if you need more info.

Visual Basic & Context Menu

Is there a way to add a Header to the popup menu? I don't find a property for this.
You could also simulate a header on the context menu by putting the information you want to display in the header as the first item in the context menu. Put a separator (or perhaps two) underneath it and put no code behind it.
That visually separates the item and users will learn pretty quick that clicking the first item doesn't do anything.
This may not work in your situation, but whenever I needed to show a context menu off of a grid row that wasn't the current/highlighted row, I made that row the current row first, then showed the menu. That would eliminate the need for a header on the menu. I assume you're showing the context menu if the user right clicks on the row. Well before showing the context menu, make sure that row is current and highlighted.
Do as Corin says, but disable the first item as well. If you disable it, that should remove confusion entirely.