Getting a single item's details (from a list of items) display in a material ui's DialogContent from openDialog button click - reactjs

I have this component where I'm getting response data from api as an array. I'm then using the map function to iterate through it and display the data in a page successfully. Beside each record, I have an action button that should display single item's details in a react material ui dialog box. The problem is that I don't know how to select an individual item and instead the dialog box is returning all details for all items in the list. I'm using a functional component.

Actually I found a solution on this, I created a new state to hold an individual current id, used the filter method to get each element in the array and then loop through the list and return an individual item on the dialog content using the specific id.

Related

React - Divert Scroll Action on React-Boostrap-Table-Next

We have a list of values displayed using react-boostrap-table-next, and another list with same number of elements lets name it placeholder, we dont display the placeholder list using react-boostrap-table-next. There is some requirement where we want to automatically scroll the list displayed using react-boostrap-table-next, on scroll of the placeholder list.
I am wondering how it can be done?
I tried using refs to the list displayed using react-boostrap-table-next, but to no avail as it does not have the scrollTop property.

Ag-Grid keep custom filter open during interaction with dropdown

I have a custom filter component I'm giving Ag grid for each column. The component contains a dropdown. When user selects an option from dropdown, the filter closes immediately on selection rather than staying open like it should.
How can I keep the filter component to stay open on selection of option from dropdown?
Reading the docs more, I found the answer here:
https://www.ag-grid.com/javascript-data-grid/component-filter/#custom-filters-containing-a-popup-element
Custom Filters Containing a Popup Element
Sometimes you will need to create custom components for your filters that also contain popup elements. This is the case for Date Filter as it pops up a Date Picker. If the library you use anchors the popup element outside of the parent filter, then when you click on it the grid will think you clicked outside of the filter and hence close the column menu.
There are two ways you can get fix this problem:
Add a mouse click listener to your floating element and set it to
preventDefault(). This way, the click event will not bubble up to the
grid. This is the best solution, but you can only do this if you are
writing the component yourself.
Add the ag-custom-component-popup CSS
class to your floating element. An example of this usage can be found
here: Custom Date Component

react-window-infinite-loader material-ui autocomplete

I am trying to show an infinite scrolled list inside a material-ui Autocomplete dropdown list, using react-window-infinite-loader. When I scroll to the bottom of the list, I want to fetch the next page of items from the server. I created a codesandbox example which combines the material-ui Autocomplete example for a virtualized list with the react-window-infinite-loader example. When I scroll to the bottom of the list, the next page of data is loaded, however something is causing the list to scroll back to the top. How can I keep the scroll position after new data is loaded?
Thanks!
I got this to work by using the useAutocomplete hook. I created a sandbox which shows the working code:
https://codesandbox.io/s/material-demo-0fbyb
There is only one problem, that I still cannot figure out. When pressing the down arrow key on the keyboard to select items in the list, you can select items beyond the visible "window" of items. There must be a way to get the list to scroll to the selected item. I am guessing this is because the autocomplete ref needs to be set on the FixedSizeList component, but how can I do this when the InfiniteLoader also needs to pass a ref to the FixedSizeList component?

material-ui: How to always show nestedList toggle, regardless if there are no nested items

I have a Material ui that I am using as a tree to navigate my store's entities.
I want the nestedItems to load as and when required, and am using the onNestedListToggle function callback to fetch the items from the server to populate the nested items.
Unfortunately, the api doesnt (obviously at least) expose a prop to configure the listitem to show the nestedlistitem toggle regardless of whether or not there are any nestedItems. This means there is no button/toggle available to me on initial render that will allow the user to load the nested items on expand.
Am I missing something?

Apex radio button check from controller

I have a scenario and i ma getting no where:
I am having 20 record and i m using pagination via standartcontroller and my page size is 1.
one by one record are displayed on the screen and i am having a list or radio button to select options.
When user select a radio button i am getting its value and fill a map with record,value for some processing.
What i want to do is that when a user hits back button the option he has selected in radio button must be visible there. But its not coz every time i m filling new values in the radiobutton list so old values are not sustained.
What i want is when user hits back button he should be able to see the old radio button selected.
How can i achive this:
1.Is there any way to make a radio button list's values be checked through controller.
2.Do I need to use wrapperclass to do this.
Help needed.! Thanks
It will be easier to put this field into object. If you don't have such field in you sObject than I would suggest to create wrapper class in your controller and display list of this wrappers instead of your native sObject.
If your radio button field is already part of the object, then there's no need for a wrapper class, but if the radio button doesn't need to be part of the object then use a wrapper class to keep the object simple.
Check out this example of a wrapper class with check boxes.
Wrapper classes don't have to be complex.

Resources