Material-ui List select multiple items - material-ui

As shown in the documentation example you can implement a selectable List.
I was wondering how would one be able to make the list to support multiple selections.
The method that was used in the example is makeSelectable. There doesn't seem to be any documentation regarding that method and I wasn't able to find anything substantial in the issues of their git project.
Any help will be appreciated.

Create a state variable selectedItems to keep track of selected items of the list.
ListItem supports checkboxes, so you can create a checkbox for each ListItem, add an onCheck handler to it and pass to it a unique value to identify which checkbox is checked and based on that you can modify the state variable selectedItems.
Alternatively, you can use Menu in place of List as it has the property multiple. You can set it to true and that's it.

Related

Restricting selection of items on selection of specific item in Multiselect

I am using multiselect pugin to implement multiselect list in my flutter project. In the project I want to add the functionality like,
the option in list are all, first, second, third
Now when I select the all option then the multiselect should restrict the user from selecting other options as he has already selected all option. and when user selects the remaining options from the list except all then he should be restricted from selecting all.
Is it possible to achieve in flutter? I've tried few options like restricting the list showing values or adding vlidation but not getting expected result.
The plugin I am using is: https://pub.dev/packages/multiselect
Please help me with the slution...
I wouldn't mind using custom build multilist with expected properties.

How to compare items in the gridview in flutter?

I have been trying to but can't figure quite how to create a gridview displaying items from a online strore and to be able to compare between two items that have been selected from a checkbox. Does anyone how to do this?
You could overwrite the equality operator and hashcode for your GridView Item class.
Official Equality override documentation.
Then you can just compare those items via a typical == operator. Remember, always override hashCode property when overriding the == operator.
There's also a common library that is used to simplify this called Equatable. The usage is pretty straight forward if you check the examples on pub.dev
I don't have access to the items from your online store, instead I used freely available data about Harry Potter Characters.
I used a gridview to display the data items. Once two items are selected a bottomsheet pops up showing the comparison.
Here is a gif of the working app, code can be found here.
I used flutter_bloc to implement the bloc pattern to this app. All the logic is managed in CharacterBloc which responds to three events
Fetching data
Selecting characters
De-selecting characters

Autocomplete in swift with select item and pass object

I have seen many examples and tutorials about setting up autocomplete in swift. Mostly related to the search bar. But they do not include how to select the item in the drop-down and close the table view. Once you select the item how do you get access to the entire object. Also most data is coming from REST based API. Finally the search autocomplete should be incorporated with the existing view components.
Looking for examples or tutorials that address
adding search autocomplete to existing view
drop down data based on REST API. search term passed to API. Data includes entire object, not just name.
select item from drop-down and get entire object
hide table components and if necessary hide search components.

How can I add a custom column menu tab in ag-grid?

Is there a way to add a custom column menu tab with my own favourite icon which on click would render my custom react component?
something like
myColDef.menuTabs: ['generalMenuTab', 'filterMenuTab', 'myCustomMenuTab']
FYI I'm using v12.0.2
What you're after can't be done I'm afraid. The grid supports React components in all sorts of ways (renderers, editors, filters etc), but not via the column menu.
I've updated the docs page to remove the gibberish issue - it'll be fixed properly in the next release, thanks for highlighting this.
This would be helpful to have. In particular for us, we'd like to filter based off row properties, and not row values. Creating our own tab to filter by cell colors that we have assigned with our own set of labels would be useful.
I agree that it would be a nice feature to have. Apparently, there's no quick out-of-the-box solution to do it. The only workaround I see is to implement your own custom Header component which would display any buttons your want.
There you can put a button to open your own custom menu, which you can implement as any regular UI component. It also means you'll need to manually implement all standard menu options that Ag-Grid provides out of the box if you need them.

Show/Hide different fields Based on dropdown value in Magnolia content app?

I have created a content app in which I am able to show and hide different fields using radio buttons but how to Show/Hide different fields Based on the dropdown value in Magnolia content app?
For radio button and fields i used below class info.magnolia.ui.form.field.definition.SwitchableFieldDefinition
and for transformer class i used
info.magnolia.ui.form.field.transformer.composite.DelegatingCompositeFieldTransformer
but now i want to use
info.magnolia.ui.form.field.definition.SelectFieldDefinition
instead of SwitchableFieldDefinitionbut I am unable to do so with any of the transformer class.
I also searched and found similar thread here but it has the incomplete answer!
According to https://documentation.magnolia-cms.com/display/DOCS/Switchable+field you can define a property named "selectionType" with the value "select".
I haven't tested that though.
If you have a look in SwitchableFieldDefinition, it looks promising though, because there's really a property with that name and it just defaults to "radio" but can be overwritten.