Semantic-UI-React Dropdown Selected Index - semantic-ui-react

I am trying to set a default selected item in a semantic-ui-react dropdown. If I select an item from the dropdown, when I reopen the dropdown it opens on the correct item. However, this item is persisted, and when I refresh the page, the correct items are displayed on the dropdown, but it does not open on the correct item.
Please advise.

Matt, it sounds like you are only using the internal component state. Whatever your components initialize with, they will always start that same way. Your entire React application works this way. If you are expecting your data to be persistent, it needs to be stored somewhere. When you refresh you are starting over again. If the state of your application is not being put elsewhere, you lose that state every single time you refresh because the only copy of state is in your client browser.
Basically you currently only have a frontend application that is not storing data anywhere. Depending on your needs, you could do this in a lot of different ways. A REST API. A GraphQL API. One simple way to accomplish this if you are just creating a simple website would be to use a headless CMS. That will give you a database to store your application data. There are a lot of interesting ones out there that you can explore based on your needs.

Related

Where is the way to pull out requests from a collection?

Update: I see that the issue was I had hidden the left sidebar which has all these features.
So just imported a huge collection for postman. Import worked fine. Now what I was expecting is that I could just easily pull out an individual request from the collection and inspect it like any other. I also expect that I can create a request using one in the collection as a template. There must be a way to easily share groups of requests and examine them like others. Inside the collection runner is the only place I am seeing the individual requests. I mean New (Does not allow it to be selected), Import (Already Done That), Collection Runner. So where is the way to pull out the request? Actually I went ahead and ran the collection with just one request by deselecting all except the one. But the way it is inspected is looks much different. And I want to run this request as all the others are run and inspect it just like the others. I mean this should be the most intuitive thing.
Where is the option here to use one of the requests from a collection?
This is right after clicking new
So I decide I want to create a basic one. Now what?
What indicates the collections selected or available during creation of a request?
So what I can't find is:
1) A easy way to select a collection for use application wide.
2) A easy way to select an individual request from the collection
and run it individually.
3) An easy way to just open a collection
One that is not only collection running. Maybe editing or using one of the items as a template for another request. Also when I click on the left hand side of a request I see a menu but nothing at all comes up. I mean collections of requests should not be just for running in collection runner.
This is the main issue. Beyond that what about editing the requests from a collection?
Using a single request from the imported Collection can be down like this:
Select the Collections Tab (If you're not on it already)
Expand the Collection
Select the Request you want to use
Hit Send to use the request
There are a number of ways to use any Request as a template for other Collections. You could make a copy of the whole Collection and rename it or if you just wanted a single Request in a new Collection you can do the following:
On the Request select ...
Select Duplicate to make a copy of the Request
Select the Save As option
From here you can rename the Request and also create a new Collection containing that request.
There are a lot of things that you can do with the app, maybe either looking through the learning centre:
https://learning.getpostman.com/
Or using the in-app Bootcamp will help you understand the app more and what it can offer you:

Ember Substates with Ember data after store already has data

I have read Ember docs related to Substates etc and I understand how it works. In my current application my loading.hbs and other child loading.hbs templates work fine.
I just want to discuss a use case.
In my route A, in my model function I do fetchAll for my model.
I go to Route A, First time api request is sent and I see my loading screen.
now I navigate to some other route B.
now I come back to first route A, api request is sent again but this
time loading screen is not shown.
I want to develop my understanding here. Now the second time loading screen is not shown which tells us that store had data so there is no sense to put it on loading and after fetch store sent request to sync with backend.
QUESTION
Now I want to know if this is a default behaviour of Ember with Ember-data?
To show this loading screen, will I have to do something manually?
Ideally what I want is, if on second request data was fetched then show it and at the same time show loader to tell user that it is syncing with backend as well.
I know everything can be done manually, I don't want to reinvent the wheel or do things in non-conventional way. So I want to know best optimized solution for this as provided by Ember which an experienced Ember developer can help me understand.
Thanks in advance.
Now I want to know if this is a default behaviour of Ember with
Ember-data?
Yes, that's the default behavior of Ember data when you do a findRecord or findAll where shouldBackgroundReloadRecord or shouldBackgroundReloadAll event of the adapter respectively, is defaulted to true. You can turn this off by returning false and ensuring shouldReloadAll or shouldReloadRecord respectively are set at true to ensure the request always hits the API and not fetches from cache.
Ideally, showing data immediately on the screen is always advisable as it has a better UX in terms of giving the user a feel that data is already there and that some parts of the data is being fetched. Check here
To show this loading screen, will I have to do something manually?
You may also want to read this
To add further details after my own research, I found helpful and relevant details in Ember docs.This is all about caching.
If records were already there then promise will be resolved immediately that's why I don't see loading screen for already loaded record, at the same time Ember-Data syncs with backend as well and re-render the template.
Ember Model Docs
Caching
The store will automatically cache records for you. If a record had already been loaded, asking for it a second time will always return the same object instance. This minimizes the number of round-trips to the server, and allows your application to render its UI to the user as fast as possible.
For example, the first time your application asks the store for a person record with an ID of 1, it will fetch that information from your server.
However, the next time your app asks for a person with ID 1, the store will notice that it had already retrieved and cached that information from the server. Instead of sending another request for the same information, it will give your application the same record it had provided it the first time. This feature—always returning the same record object, no matter how many times you look it up—is sometimes called an identity map.
Using an identity map is important because it ensures that changes you make in one part of your UI are propagated to other parts of the UI. It also means that you don't have to manually keep records in sync—you can ask for a record by ID and not have to worry about whether other parts of your application have already asked for and loaded it.
One downside to returning a cached record is you may find the state of the data has changed since it was first loaded into the store's identity map. In order to prevent this stale data from being a problem for long, Ember Data will automatically make a request in the background each time a cached record is returned from the store. When the new data comes in, the record is updated, and if there have been changes to the record since the initial render, the template is re-rendered with the new information.

How to get a list of all page-level APEX_ITEMS in the current page?

I have an Apex application that is quite large. The need has come up to store detailed usage logs of this application. The information on APEX_WORKSPACE_ACTIVITY_LOG is not enough, because I need to know what queries each user runs on each page.
My first thought was to get the actual Oracle query logs (V$SQL and such), but they provide no information on the user (as far as the database is concerned, all queries are made by APEX_PUBLIC_USER). I have some information about the user on V$ACTIVE_SESSION_HISTORY, but that's incomplete because it stores samples of active sessions and their SQL queries at 1-second intervals, so I miss too many queries.
So now I'm off to implementing application level logging. The "right" way to fo this would be to go through all the pages in my application and create a logging process to store the relevant information for each one (username and some page items). But I wonder if there might be something simpler that does the trick.
If I understand correcly, "application processes" are run by every page in the application. So if I can get an application process to iterate over the list of page items, I can store them all in the database and be done with it. Something like
for item in page_items {
log(username, item_name, item, date)
}
Can this be done? Or maybe the information I need is on the database already and I don't see it?
You can query the metadata tables to get all items for a specific page and then use that to get their value.
select item_name, v(item_name) item_value
from apex_application_page_items
where application_id = :APP_ID
and page_id = :APP_PAGE_ID;
That will capture all items on the page. Don't forget that if you use items on Page 0 (Global Page) you may want to query that page too.
Additionally, you may want to capture application level items too.
select item_name, v(item_name) item_value
from apex_application_items
where application_id = :APP_ID;

Access list data as a group

We have a company program designed to help us get control over data. It has feature to group all the application of one Client. If I want to take a look at them I click on the Client and I see a list of all applications made for him. Take a look at the picture below:
I was wondering if Microsoft Access can do the same? If yes where should I start looking?
I did some internet search and no solution found.
That is built in, and it is called Subdatasheet. You have relationships properly set between Clients and Order, for instance, when you open the Clients table you will see such small "+" allowing to view the Orders of the current client. You may have to set the Subdatasheet Name property of table Clients to "Orders" in this case.
If you want to work with forms, you can build a continuous from for Clients, then one for Orders, then insert the Orders subform in the Footer of the Clients form. Access might tell you you can't do this, just ignore, it works.
In Access that would simply be a continuous form with a filter. Typically opened from a list of clients, setting a filter for the applications of the selected client.
Unless I'm misunderstanding the question.

Keep value state in apex page

Does anyone know to keep the state in an apex page when I go to another page and return?. It doesn't keep the values entered in the fields, it appears all empty. I appreciate anyone can help. Thanks
What is your ApEx version ?
By default, when you submit a page, item values are automatically set in session state, so you should find them again when you go back to the page.
Be aware that Firefox retain form element values on page refresh, so displayed values may not correspond to values that are really in session state... A solution is to set the «Form Auto Complete» attribute to "Off" in your page security attributes, or use $('#wwvFlowForm').attr('autocomplete','off'); on page load.
If you want to set a value into session state manually without submitting the page :
from PL/SQL, you can use APEX_UTIL.SET_SESSION_STATE (see documentation)
from JavaScript, you have to call a dummy application process, like :
setItemInSessionState: function(p_item, p_value) {
var l_get = new htmldb_Get(null,$('#pFlowId').val(),'APPLICATION_PROCESS=dummy',0);
l_get.add(p_item, p_value);
l_get.get();
}
Finally you can choose to maintain session state per session, or for a user across sessions, by changing «Maintain session state» attribute in the source tab of your item. And if your data is sensitive, you can set «Session State Protection» attribute to "Yes" for your item.
There are a lot of other solutions to keep item values between pages : passing values in the URL into hidden items, apex collections, basic database storage, cookies, etc.
If this does not answer your question, you might give more details.
Maybe you should use session in order to save the inputs and then when the client returns to that page, you will just put the data you have stored in the sessions.