react-dropdown-tree component: Use ellipsis to prevent line break - react-dropdown-tree-select

I would like to prevent the component from expanding vertically as more items are selected. If some items do not fit into the row, I would like to have "..." signaling the user that further items were selected.
The following example achieves this behaviour for react-select:
https://codesandbox.io/s/v638kx67w7?file=/index.js:1219-1231
What is the best way to do this with react-dropdown-tree?

Related

Material UI AutoComplete component size behavior

I want autocomplete(for me it's a search bar) component to stay in one line and expand when searching. Sadly, the component adds another line when there is a long chip.
For example:
the image shows that the component added a line
how can I stop the component from adding a new line while maintaining it's behavior while writing in it (when you write in the component it expands to show the entire search)
I tried changing its CSS a max lines prop but it didn't work.
granted I might missed something in the CSS
To summarize the behavior of the bar:
it is a multi select
There are two situations
the user isn't using it.
In that situation the bar should just be one line nothing more
the user clicked on it and editing in the bar
In that situation the bar should expand vertically to and show all the chips
right now It correspond with the situation that I described, but if a chip that is too big it expands to two lines and I want it to stay just one line if it isn't situation 2.

How to prevent row deselection in a Mui Datagrid?

Currently using Mui 5 and ran into an interesting issue. There's a prop to prevent selection of a row - isRowSelectable; however, there doesn't seem to be a way to prevent de-selection of a row.
Here's the use case: when the user selects all, we want to prevent them from deselecting any individual rows (until they deselect all).
Example of isRowSelectable (https://codesandbox.io/s/nez8ec?file=/demo.tsx) need one for controlling deselection.

How to implement material-ui tabs with More dropdown (as shown in documentation screenshot)

I am looking to implement a Tabs component containing lots (7-9) Tab components for a desktop view. I do not want to use the scrollable tabs when it exceeds the viewport width on the Tabs, instead I want the extra Tab items to be in a More dropdown menu just like the example docs show below:
Questions:
What is the intended implementation to achieve this? I actually would like the exact same functionality they describe as well where when I click an item from the dropdown above (for example, books), that will swap positions with the Tab directly to the left of the More dropdown, as shown in this screenshot from the doc:
Specifically, is the More dropdown a Tab component, or a Dropdown Menu component?
When using, how does selecting a tab/option from the More Dropdown work by default? (ex: will the selected tab then get moved to the visible tab portion, just like the screenshots?). Or does this need to be done manually to achieve that result?
Lastly, are there links to any examples of this usage?
Late, but it may help someone.
I was able to achieve dropdown within tabs by using the popover component.
https://codesandbox.io/s/436906013w
It has three tabs - One, Two and Three. Clicking on Tab 'Three' will perform the normal tab change. Clicking on the dropdown arrow next to tab 'Three' will provide the additional options.
It is not an exact solution to the question but can be achieved with a similar approach.
I created logic with MUI List, u can customize it with MUI tabs.
I calculate the width al all items and check if we have enough space, if not I added more button with dropdown and added the rest inside. Be aware that now it does not recalculate if the width or length of items changed
https://codesandbox.io/s/muddy-paper-941ff?file=/src/App.js

How to use a select dropdown in a virtualized list?

Im currently developing a react app which has a virtualized list (https://github.com/bvaughn/react-virtualized) in it. The items in the list may contain a select dropdown.
The problem now:
The virtualized list is hiding overflow. So the last items dropdown is not displayed and you cannot scroll down to view the content of the dropdown:
================= Here is where the image ends ================
I have no idea, how I could fix this issue, without changing the virtualized list code. Anybody out there?
react-virtualized can't use overflow: visible without breaking scroll behavior (which is pretty key to how react-virtualized works). So things like drop-downs will get clipped as you've observed.
What I typically recommend for people wanting to put things like drop-down menus inside of react-virtualized rows is to use a portal. This allows the menu content to expand outside of a single row (or even the entire List) without being clipped.
I've used tajo/react-portal in the past for this.

How to hide grid columns effectively

I have a very large grid with many columns. When the user clicks on the button, it calls a function which analyzes the whole store - cell by cell, if it finds no changes in a particular column, it hides it, othewise the column stays visible. Very often quite a large number of columns get hidden, but as I can see, this operation - column hiding with all this rendering - is very "heavy", so that my browser may alert, that the code runs for too long.
I do hiding like this:
var cols=grid.headerCt.getGridColumns();
Ext.each(cols, function (item, index, all){
if(condition) item.setVisible(false);
});
I tried to use Ext.suspendLayouts() and Ext.resumeLayouts(), but it leads to a bug. Even though operation now runs faster, instead of column hiding only columns' titles get hidden. So, I need a more optimal and working solution.
suspendLayouts() and subsequent resumeLayouts() is one of the ways to go. You only need to call grid.getView().refresh() after you resume the layouts.
Another option would be to call reconfigure, however, this removes the "hidden" columns from the columns menu.

Resources