FullCalendar: is there still a viewRender event hook? - fullcalendar

I need something like the viewRender event in order to persist the user's state. I'm building a UI where users will frequently jump in and out of the calendar, so preserving their view/range is essential for a pleasant experience. Does this exist in v5? The last mention I can find of it is from v3.
The only workaround I can think of right now is a direct click handler on every view control element, or a very heavy-handed MutationObserver. This is a React app so either one is going to be super awkward.
Thank you!
Edit 2021-02-11:
I looked at the available view render hooks but none of them address my problem. What I need is an event that will fire whenever the view state changes, including clicking between weeks/months/etc., so that I can persist the date range the user most recently viewed as well as the view they had selected.
viewDidMount is the closest to what I need, but it does not fire when the date range changes.
Edit 2021-05-26:
Another problem with using viewDidMount is that using it to enact side-effects is a bit overeager. The hook gets called whether or not the user has actually done anything, and the default view always gets passed as view inside the View Object. So there's no way to tell whether this mount event contains data I should persist or not.

Related

Is there a way to track any form being filled on google tag manager?

Is there a way to track any form being filled on google tag manager? I looked at the options, and there doesn't seem to be a way to do this, I can capture events for form submission, but not when the form is being filled by an user. Is there an easy way to do this? I tried to capture the event with input being clicked by the user, but it triggers on every page load. Check if one of the input field in the form is being filled.
Well, you generally have two ways of doing it: ask your front-end devs to write the code and just send you a dataLayer event when it happens, or write the code on your own.
If you're not able to delegate it to the FE devs, then you will have to write it on your own. Consider what you want to do. The simplest thing from here would be detecting clicks on that one field, assuming that if a user clicked it, then they will fill it. Tracking like this is not perfect since there are other ways to fill a field without clicking/tapping it And also there will be cases when a user clicks it, but doesn't type anything. But this is probably what you want to do. For this, you only need to pick a right CSS selector and use built-in funcitonality of GTM.
If you actually want to track when the field changes input, you will have to write your own event listeners and with it, send yourself dataLayer events and then listen to those and send the event accordingly.
This is what you want to know about the change event: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event
You will also likely want to prevent event sent on every change, so make a blocking variable that you set after the listener callback fires once.
This is very messy. It's not likely worth it to go this route.

ASP.NET how to pass a reference to a particular control

I'm generally an ASP.NET MVC guy, so the "standard" ASP.NET stuff is a little difficult for me to wrap my brain around. I've tried looking for the answer, but the keywords I'm using seem to be too generic... I get a lot of close answers, but not what I'm actually looking for.
I have a grid that is populated from a data set. One of the fields is a dropdown with 4 possible statuses. When the user selects a status, an event is fired in the codebehind to make the change in the db immediately.
There is a particular status that I need to confirm, because once it's selected, it's irreversible. Figuring out how to have the back end pop up a confirmation box was annoying, but I think I have that part done now.
The problem is, if the user confirms that the status they selected for the dropdown was intended, I need to disable any further changes to that dropdown, either by disabling the control or by removing the row altogether. With this requirement, I imagine I need to pass a reference to the specific control that fired the event back to the script, so that it can pass it through the postback, where I would need to consume it.
I have no idea how to pass a reference to the control (what can be used as a reference?) and I have no idea how to use that reference in the postback.
Any help would be greatly appreciated.
;p i was waiting for you to find my post on the issue lol.
but to put it simply, you postback to the page, all members are still available to you if you instantiated something in codebehind. if not, then use FindControl to pull them from DOM. here's the passing values stuff.
as long as you don't kill the lifecycle, you're fine: Passing dropdownlist selected value to another page's dropdown list
and here is the linkspam (full docs): How do I keep TCP/IP socket open in IIS?
probably the articles on session-state and page lifecycle will be of most use.
To prompt the user for confirm add this attribute to dropdownlist.
onchange="return confirm('Confirmation Message');"

Ajax enabled search for products with multiple criteria

want to have search functionality as on this website
http://www.carwale.com/new/search.aspx#budget=6&budget=8&fuel=2
here whenever the user filters search(checks any checkbox), it updates results accordingly,
that can be understood as an ajax filter.
But at the same time, the query string also reflects for the change,
which helps the user to bookmark the filter search for later reference.
changing it through asp.net/javascript may cause the page to reload..
any hint or suggestions on implementing the same would be really helpful..
This can be done with the help of 3 things together
1) as #Aristos said, checkboxes with Auto Postback enabled
2) Ajax control toolkit Modalpopup, which gets fired automatically on every async postback (http://weblogs.asp.net/ruslan/pages/ajax-update-progress-updateprogress-in-ajax-modal-popup-modalpopupextender.aspx or http://mattberseth.com/blog/2007/07/modalpopup_as_an_ajax_progress.html)
3) History Points (http://msdn.microsoft.com/en-us/library/cc488548.aspx)
This can be done completely without the use of jQuery, if you dont want to use it.
-- For the first part, he have a set of check boxes list with autopostback.
In every post back the list is updated base on the selected check box.
All is simple until now, the cool is that is have a nice interactive interface (made with javascript and jQuery).
-- About the second part, how its change the url so can be bookmark with out reload the page. The trick here is that is place the parameters after the anchor # eg:
/new/search.aspx#budget=2
Using the anchor # the page is not reload and stay as it is. So when some one click on the check boxes, via javascript is also update the url, but only what is after the # so the page stay as is with out fully reload.
Now the parameters after the # can not read on code behind but only via javascript.
So when you have bookmark this page and you go direct to eg /new/search.aspx#budget=2 the javascript reads what is after the # and translate it to commands, check the appropriate checkboxes, and ask for refresh the content. All that can be done only via javascript.
I see that is use the jQuery history plugin as helper with this schema.
http://archive.plugins.jquery.com/project/history
The same trick with parameters after # is done from amazon, when you navigate on catalog, from page to page.
-- One more clever trick that is done is that is open a full page wait, so the user can not interact with the page until the page is ready again. If it not do that, and the user make very fast two clicks on the check boxes, then this can cause a full page post back on updatepanel and this can lose the previous settings.

What is the right way to handle mode parameters in MVC?

My app has a number of ambient properties, like the current CountryId, DocumentMode, etc. As I learned in a previous question, the current value of these properties should not be stored in the Session, but rather sent in the query string on every page request. So far so good.
So when I build a page, I want to arrange that all the action links look like this:
/controller/action?CountryId=x&DocumentMode=y&...
I can easily do this by checking the query string and slipping in the current value of each of these variables.
The question is, what's the right way to notify the app when one of the values changes?
Specifically, at the top of each view, I have a select dropdown that shows, e.g., all the countries. What should happen when you select a new one?
Right now, the change triggers a javascript function call that replaces the CountryId in the query string, and calls an action that just reloads the original page, but with the new CountryId set, and so the new action links are rebuilt. But this seems sort of kludgy. Is there a more elegant way to just update all the links on the page without needing a server refresh to do this? (I could always cook up some script to do this, but it doesn't seem trivial, and I don't want to reinvent the wheel if there's a built in way to do this.)
Any help much appreciated. Thanks!
You could put the part of the page that changes in a partial view and reload that view via AJAX each time a control is changed.
Partial rendering after page loaded
Alternatively you could just write some javascript to update all the links. Post some code and I'm sure you'll get some suggestions on a good way to write it.
I decided to keep things simple for the time being and just refresh the whole page, which recreates all of the links. My app is low volume and this suffices for now. If I ever need to build an app where the server can't be foolishly stressed like that, I'll see about the swap-in-place solution.

Why does my session variable appear to empty itself in ASP.NET?

I have user control on a ASP.NET web page, which contains a GridView and a radio button selector.
In the underlying middle tier I have a thread which goes to the database and then raises an event to say "I have some data" my User control handles this event and sets a Session Variable.
This works and I can see the event being handled and the Session variable gets the new data.
However when i go to use this session variable when the selected index of the Radio button selector changes the Session variable reports as "Nothing"
I have ensured that the obvious (i.e. spelling, Sessions switched on etc) are correct.
The GridView and radio button selector are encapsulated in the same Update panel.
Check that if your UpdatePanel - updatemode is set to 'Conditional'? also Child as triggers? I would first start by putting a stop in your page load, see whats happening from there. Do a search for all places where you populate that session variable and put a stop. You may be surprised, I have often found that page lifecycle gets confusing even though I thought I understood it. Alt - post some code and we can step through.
Yeah, sounds almost like a problem with order of operations or not checking for postback on a page load or something?
Like JamesM suggested, running your website in debug mode should really help identify the problem. You can bring up your watch window and set it for the Session variable you're looking for, then set breakpoints all over and check the value at each stop to divide and conquer the code.

Resources