At the moment, there is a calendar on my site where the user can select a time range and data filtering will be done. For this I use the react-advanced-datetimerange-picker library.
But there is one drawback. You cannot cancel the selected data without reloading the page.
Please tell me how to make a button (example near close button) that will allow you to reset the entered filters and get the entire list of data again.
I created a function called resetDate which when clicked return the Calendar to its initial value, please check.
https://codesandbox.io/s/proud-architecture-9v7e84
Related
I have an page item and an interactive grid on an apex page . Page item is of select list type and base on the selection the data in the grid changes. I have default Add row button in the grid to add rows . I want to refresh the grid after after click on the SAVE button in the grid. If the grid automatically refresh itself after a fixed interval of let's say 2 or 5 second that is also good for me.
For the current scenario the rows are getting added but are not reflecting on page in the interactive grid after clicking on SAVE but entries can be found in the table in the database. After reloading the page the entries are reflecting in the grid.
NOTE : I am working over a database link for fetching the data.
There is a way to hook upon the built-in save action of the interactive grid.
Steps below will create a custom event, listening to the interactivegridsave event. That event is fired by APEX after the Interactive Grid has completed its own save process. Make sure the event name is spelled correctly.
Create Dynamic Action
When → Custom
Custom Event → interactivegridsave
Selection Type → Region
Region → <your region>
Refresh action (maybe turn off Fire on Initialization)
I think this will help you.
When you add rows to your Interactive Grid and hit save button, it refreshes and you can see the IG updated.
In case you need to refresh the region or the page every 5/10 seconds, please follow these steps:
Define a Static ID for the IG, for example "IG1".
In the page attributes, navigate to Execute when Page Loads and enter:
var model = apex.region("IG1").widget().interactiveGrid("getViews").grid.model;
setInterval(function(){ model.fetchRecords(model._data); }, 10000);
This is going to refresh the IG every 10 seconds. You can set it to 2 or 5 seconds.
I had something similair with filters, If I added a row that shouldnt show up due to the filter I had on it would still be there until I refreshed. Of maybe if I changed something so it should no longer show up, it saved, but still showed up.
What I did was do a page submit after saving.
I have a Dynamic Action on Click Selection type jQuery Selector and the selector being [data-action="save"]
Then the action is simply Submit page.
This way after you click save, it submits the whole page and reloads.
Hope this does what you need.
I have an issue I wonder if this fine community can help me out.
I have a webform asp.net (using vb.net code behind) web application, on one of my forms has a datagrid. Each record can have a different status and each record can be selected via a checkbox. At the bottom of the grid I have a dropdown of possible actions that users can take, these actions will be against the records selected and a button to invoke the action selected.
Now the issue I have and I am getting rather annoyed at it is that due to the difference in status before I complete the action selected i need to check whether the records selected can do such action.
Example
I select records 1,2,3,4,5. The action I select is to download in a CSV format, however only records which are unlocked can be downloaded, so in my example only records 1,3,5 are unlocked. This means I can only download 1,3,5 and not records 2,4. Once downloaded I want to mark the record that it has been downloaded and refresh the grid.
I have this completed this by finding the records to be downloaded (aka 1,3,5), create a CSV (or XML as that is also one of the actions) as a string, mark the records 1,3,5 as downloaded, refresh the grid and then I invoke a hidden button on the form which will actually download the data.
If Not ViewState("Data") Is Nothing Then
Response.Clear()
Response.ClearHeaders()
Response.Buffer = True
Response.ContentEncoding = Encoding.UTF8
Response.ContentType = IIf(ViewState("ExportType").ToString() = SharedApplication.ExportedType.XML, "application/xml", "text/csv")
Response.AppendHeader("Content-Disposition", String.Format("attachment;filename={0}", "records-" & "." & ViewState("ExportType").ToString()))
Response.Write(ViewState("Data"))
HttpContext.Current.Response.Flush()
HttpContext.Current.Response.SuppressContent = True
HttpContext.Current.ApplicationInstance.CompleteRequest()
ViewState("Data") = Nothing
End If
The above downloads the data, to invoke the download button I use javascript to do a postback on the click event of the hidden button.
However the issue I have is before I download the data I want to add a confirmation box, something to say "Only 3 of the 5 records will be downloaded, do you want to continue". With yes continuing download and No to stop action. How do I go about doing this. I have tried all sorts of techniques but cannot figure it out.
I have tried adding a return confirmation on the hidden button in its onlcientclik event, but this never gets fired. It does work if you actually click on the button but not when I do a postback to its click via JS.
The closet i can find is using the registeronsubmit in the code behind.
ClientScript.RegisterOnSubmitStatement(btnHidden.GetType, "confirm", "return confirm('Are you sure?');")
But this gets fired constantly, even when we I click on another button. I have tried adding another hidden button with the hope I can add the clientclick to show a confirmation box but that does not work as well.
Does anyone have an idea, I have herd of possibly creating a popup to display the messagebox but then how do I capture if my code needs to continue.
Hi I thought I better share what I eventually did to complete my issue incase someone else moves into this territory.
So I went away and thought about this more and the solution I came up and actually works pretty well although some may say this is rather an ugly way of doing this.
I use a dropdown list to mark what action is needed, so I thought why don't we use the postback event on the dropdownlist to build up the message of the confirmation box and then add the JS confirmation box on the OnClientClick event of the button.
btnRun.OnClientClick = "return confirm('" & sMessage & "');"
The message variable is a string which builds up the message depending on which process action is selected.
This means as soon as the dropdownlist is changed to an action, the codes will work out how many selected items will be changed. This is a sql query which picks up which codes/ids will be changed, then the count of data against the total count of selected items will be changed/exported whatever the action selected. This builds the process button confirmation, so when the user clicks on the process button it displays X out of X will be changed, do you want to continue. If cancel is selected nothing happens if ok is selected it carries on and completes it action as per usual before I wanted to show some message box.
When purchasing a course, the user can enter 1 or more students to register for the course. By default there is only one entry but the user can use a dropdown to select more and then the form will update to show more.
I am accomplishing this by triggering an event when the user changes the dropdown value that uses ajax to call an action which returns a partial with the appropriate number of entries and then I just replace the existing div with the new one.
My question is whether there is a way to implement this so that it's kind of like "refreshing" the page where the form remembers and automatically refills in he values the user already entered just like if you were to refresh the entire webpage. Is there a way to do this, or will I need to pass in the existing values into the action in my ajax call and have the partial set them?
A secondary question I just thought of (and perhaps this should be in another post but I will go ahead and put it here for now) is whether I should be concerned about any weird behavior with validation when doing it this way? (I'm using stock, built in validation with annotations).
Can use the below question as a reference to explain the context:
Populate one dropdown based on selection in another
On my page; after selecting the proper values from the dropdown lists and filling up a few text fields, the user submits the form.
The next page is for the confirmation, that asks the user whether he/she wants to edit the form.The edit button just takes back the user to the previous page (window.history.back()).
Now the problem is, every field on the page has retained the value that was filled by the user. Except the second dropdown list (dependent dropdown list).
Is there a way to fix this?
Without the context of your specific code, it's hard to answer well, but you should look into using the window.sessionStorage or window.localStorage to temporarily store data for persistence between pages in javascript.
I am using a dropdown, a devexpress grid view and a button on my page.
My gropdown contains the months in the format MM/YYYY, and on dropdown's selection change the data binds in the grid view.
the functionality of button is to go on previous page as same as back button of browser.
Now, my prob is that if i select any month and then select another month, the data changes.
but now when i click on back button having onclick ="history.go(-1)", changes the data on the grid view but the month in the dropdown remains the same.
For example:
Suppose, first i have month selected as 02/2010
At this time the data in grid view is for exapmle 01234
now when i select month 03/2010
the data in grid changes to 56789
now when i click on back button, then data in grid changes to 01234 but the month in dropdown remains to 03/2010.
Please help me for this..
Thanks in advance for all who will give solution for this.
Server side web page should have a page-timeout. so that browser will get contents back from the web server again instead of showing it from history. Or browser might show the page as content Expired, please refresh.
The browser is caching your page. You should add a session tracker or something to your page and LINK back, (aka not JS)