I'm very new to NgRx and am trying to wrap my head around it. I understand the objective is to have a data store where different types of state reside. I'm trying to understand how to work with lists of data.
Scenario 1:
user first navigates to a list in which case an effect fires to retrieve list from backend/API. On success, the list is saved to the store and the UI component responds to the observable via | async and renders the list. The user clicks on an item to view the detail. We can either store the selected item's Id in the store then simply use a filter mechanism to retrieve the detail data from the list array in the store. Or, we can make another effect call to server for detail payload. I'm assuming the decision point here is if the list contains all of the data needed for the details page?
Scenario 2: assuming the list in the store contains all of the data required for the detail page and user clicking on an item in the list simply saves the selected item's id to the store then navigates to the detail page where the detail data is simply filtered from the list based on the selected item id in the store, what happens when the user refreshes the browser URL on the detail page? When this happens, the list is no longer in the store and neither is the selected item's id. However, the selected item's id is in the URL and route. How do you handle this scenario? Do you rebuild the list in order to retrieve the detail record?
Scenario 3: what's the best approach for handling a scenario where you have different subsets of data from the entire list. Perhaps you need to see a list of items that are 'pending' and another list of items that have been created this week, etc. It seems very inefficient to download all records into the store as the master list then simply filter out the ones needed for different views. I've read tutorials where you have the master list in store then simply have Ids in another part of the store that make up the different slices. This seems very heavy and a duplication of the database onto the client. What is the best approach for having filtered lists within a store?
Thanks for your help and insight.
Scenario 1: You're spot on!
Scenario 2: It depends.
you can store the data in localStorage for example
the list has to be fetched via the backend API
Scenario 3: keeping your state normalized is key here (you'll work with IDs). Also we don't have to load all entities at once, this can be done partially. The redux docs has a performance section that you can read.
Related
I am using angular 9 and have forms with multiple parts.. like first section about name and personal details, second part about their primary school, third part about users past jobs, etc..
And each part has heading in a side menu.
personal details
primary school
previous job
Clicking on which user can go to that particular part of form..
The question is if the user, completes 2 parts i.e. personal details and primary school and then exits the browser.. the next time when the users logs in.. the first thing I want to display is the 3rd form i.e. previous job to the user.. so that he can continue from there..
Conversely I also want to send an mail to the user stating 'please fill the previous job details in xyz.com'
How to store this kind of data.. can it be done by angular services or need to use NgRx store as must.. if ngrx is needed.. can I somehow store the state in some form in api..
I m using Express with mysql in backend..
Ngrx store is mainly used to have consistant data in more than one component(like user name which should be same in header and profile component). for your scenario ngrx store is not needed, and one more thing, even if you want to use ngrx store when user closes data, you still have to store data in local storage or backend. so that you can use that data when user opens that page.
For your scenario use backend to store data. whenever he comes back to that page, first fetch data and fill it into fields.
Hope it helps. thank you
I am attempting to make a step through wizard in word press. I have a website with a nice theme and everything and all pages work fine. What i want to do is in one of the page collect some information from the customer. When they select one of the buttons on the site i want them to end up on a page that has a bunch of options. Based on their selection i want a certain information captured and then the wizard moves to the next page.
Step by step i want to collect 5 or 6 pieces of information that the user selects. Kind of like a wizard that the user can select their options and that gets saved to their profile. Now i am not exactly sure how database management works in word press, how i can create rows or columns based on what i need and how i can save information to these. All the word press tutorials that i find are basic and dont show this type of behavior and data manipulation. Can someone point me in the right direction where i can learn about how to set up databases and collect information from the user?
Thanks,
If you want to store the data for user you can first create User Meta Fields. You can follow this link on how to create User meta fields
https://developer.wordpress.org/reference/functions/add_user_meta/ . You can then save the data from the form in this meta fields using update_user_meta()
https://developer.wordpress.org/reference/functions/update_user_meta/. You can fetch this data using function get_user_meta()
https://developer.wordpress.org/reference/functions/get_user_meta/
I hope this helps you !!
Forge Viewer - can we make selections/highlight on loaded models and save in database so that we can show that selection next time user loads it?
Is this possible? Or how can we add sticky notes/RFI information /issues spot in the model.
I am working in a web application, how do we manage that information and save to some database so that we can show that information later when the same model is viewed again?
Thanks in advance
You can get or set the selection using Viewer APIs. Specifically, the getSelection method returns a list of object IDs that you can store wherever you want, and the select method accepts a list of object IDs that you want selected.
For more advanced extensions, feel free to browse our samples over at https://github.com/Autodesk-Forge. One demo that could be of particular interest is the "Forge Digital Twin" (source code, and live demo) which stores "reported issues" to a database, and later shows them as 3D annotations on the model:
I am trying to make the list that displays the rows of data to organize alphabetically based on the rental property's name. Right now they are all out of order and I am not sure if this is accomplished through CSS or HTML. The webpage I am speaking of can be found at http://clearwaterfloridabeachrentals2.imbookingsecure.com/rentals/allrentals/
I see that your data is coming through a web service (through Ajax), In this case the web service must send the sorted data to UI. Because even if you achieve sorting of the loaded data (using javaScript that is) your sorting will remain incorrect as the users are able to choose 'load more results' and the new data which will come will again not be sorted.
As a general rule whenever there is a web service to load paginated data (like multiple pages OR scroll to load), it is best if the service itself handles the pagination and the sorting.
One "Search" button is there in the JSP page. After taking all values for searching, the form is submitting.
In processAction(), I am getting all parameters. Using these parameters, in doView() I am consuming one API (JSON data). Creating one JSON object for input to the API and consuming it. Now I got the output JSON data and have passed it to the jsp using renderRequest.setAttribute("jsonString", json.toString());
Then showing search result using this jsonString.
Its working properly.
The issue is, its not creating multiple instances for multiple users. If one user done a search action, the same search result will show to each user if they refresh the page.
Why each user not having separate instances?
Now all users of this page can't do search action as they wish. If one user does, the same result will be shown to all. How can I fix it?
Why session of a particular user is sharing to all? Or What is the actual reason of this issue?