Getting Event data within a CustomView after setRange is called - fullcalendar

So I'm trying to build my own custom view for a month's worth of data (based on the "agenda-views.html' example) and I've been able to create a custom View class which adds itself as a button on the list of .. buttons.
When I click on that button (MyView), its setRange is called so I know the range of Events to display.
The View's renderEvents is called but is passed all of the Events that the Calendar knows about, so I have a two parter question:
(a) Is there a way I can use existing code to do the equivalent of: "given this range, give me all of the Events fullCalendar knows about"?
- or -
(b) Do I use an XHR here to pull back the data for the given range (now that I know what it is is) and Render it
I'd rather do (a) as it's more efficient (less requests etc) but I'm finding myself swamped in code and, after reading through quite a lot it haven't really found a method that says 'Get all events for this range'.
Alternatively, am I missing something? How does renderEvents know what the current range is and then render them? Or, should I be using renderSelection, which doesn't seem to get called.
Thanks!

Set up your events as a json feed, when the URL is called it will pass the start and end dates for the current view. In your function/method/action you then retrieve your events for the given dates and return them.

Related

fragment vs activity onClickButton functions - where is right place

I made an andorid application using the "activity" component. I used it for a while, but over time I found that one page was not enough for me. I needed to add tabLayout, viewPager2 and three fragments.
I needed to migrate the functionality from mainActivity to the firstFragment.
I encountered a problem with events during the XML migration. In the activity I called android: onClick = "myOnClicFunction". But is that not possible?
I know that this has been discussed several times here in several threads. However, I would like to ask how to proceed correctly.
Here in the thread Android Fragment onClick button Method is the advice "even if you are in the fragment, put the onClick functions into activity" there is another similar advice to, "if you insist to make it in a fragment"
But what is right? Should the onclick function be correct in the activity or in the fragment?
I don't want to put the source code here, because I don't know which procedure is correct at all.
I am creating a program that is for testing students. An example is displayed and a response is pending.
The first tab has a lot of buttons + saves the result to an xml files.
The second tab will contain statistics. From saved files displays how many calculations were correct, wrong, average response time, etc ...
In Activity I had functions like getQuestion(), evaluateQuestion(), saveToXml() and events zeroWasPressed(), oneWasPressed(), twoWasPressed(), threeWasPressed() ...
Where should I put all these functions when I change the application from Activity to Fragment?
on click function listener should be placed in corresponding fragment, where the button is added in fragment layout.
events zeroWasPressed(), oneWasPressed(), twoWasPressed(), threeWasPressed() ... should be placed inside corresponding fragment where those buttons were added in layout.
getQuestion(), evaluateQuestion(), saveToXml() , this function can be placed in your activity or some other custom classes, that would appropriate according to architecture viewpoint.

Google Tag Manager - Parse Dynamic Data Layer Variable

I want to parse a 'pushed' data layer string. I intend to use it to track click events and setup the appropiate funnels in Google Analytics, it looks as follows: products.view.19|view recent product|19
The first part (products.view.19) is the unique page identifier.
The second part (view recent product) is the action.
The last part is (19) is the action identifier, this way actions may be grouped and compared more easily.
So I did the following, I first created a trigger (it fires when a link has the tag 'data-trackclick' in it) which pushes the data value to a variable (variable for datalayer). However, now I want to split that variable in to 3 new variables, as described above. I selected 'javascript macro' for this but somehow it returns 'undefined'. The macro looks as follows:
function() {
var data = {{TrackClickData}};
var pieces = data.split('|');
if (pieces[0].length()) {
return pieces[0];
} else {
return data;
}
}
Obviously this didnt work since it would only run on the initial load and not (like I thought) when the macro was requested, so it should somehow be fired on the 'click' and then set the variables accordingly.
Is this possible to do? Or do I really have to add the dataLayer.push() in script tags?
A few things:
.length() is wrong, the property for array length is .length without the ()
if it exists, pieces[0] is not an array, then .length would return the string length, see How do you check for an empty string in JavaScript? for more standard way of checking for empty strings
Is this possible to do? There's virtually nothing you can't do with GTM, since you can write JavaScript code, you can do whathever you code allows you to do, and splitting a string to use parts of it as variables is certainly within the realm of possibilities.
My advise is to make your code work outside GTM first (eg test it in the browser console), then once it's all working, port it to GTM.

Lightswitch HTML databinding to a details collection

I have a simple master/details relationship where one order can have multiple revenue allocations. The order has a collection that contains these.
I want to sum a property in my revenue allocation objects and ensure that it adds up to my order total. However, if I databind on the count property of the allocations collection this gets called when you first add an empty object and not when that object has been populated. So an empty allocation is added at the time the "Add allocation" screen is created and the databind function called. That of course means that when the save button on the "Add allocation" screen is clicked, the databind function isn't called again.
Anyone got any ideas? I basically want my databind function to be called when the save button is clicked in the "add screen" and not before.
This is the HTML client - NOT Silverlight
I'm pretty sure that the solution would be to use an OData query to get your aggregate data within the databinding function of the save button - or perhaps a separate button (e.g. "Tally Order Totals"). Exactly how you do that? A bit too hard for me to answer right now, but start with a new button TallyOrderTotals and a new data field for your total. Edit the post_render event for TallyOrderTotals and lookup the allocations in the javascript in which you data bind the value of the new data field.
Somewhere you will need a piece of code that looks something like this:
myapp.activeDataWorkSpace.<datasource>.RevenueAllocations
.filter("OrderID eq " + msls._toODataString(<orderID>, ":String"))
.execute()
.then(function (result) {
// assign the result somewhere
}
I'm not saying that's something you can cut-and-paste - but definitely look at the msls.js documentation and see what you can do with querying your data inside the event context.
One quick point however - if you only need to calculate that total as a verification step, consider doing it in the SaveExecuting() event on the server side. This will allow you to throw an exception back up the tree to your HTML page which the msls.js script should render on the client side.
Hope that helps. :)

Data initialize is called before Report Start in Active Reports (Data dynamics)

Per Active reports documentation, the Report start is called first and Data initialize. Any reference to Data source inside Report start will invoke Data Initialize event. I am modifying an existing report; and to my surprise the order is reversed. I have an existing logic to get the count of nodes (my datasource is xml) in data initialize event; just because the event firing sequence is reversed, I am getting 0 as count always.
I am using Active reports for .NET 2.0 ( I think the version is 4.*). As I dont have support for the designer, I have the designer xml and code behind.
Please suggest what could force the event sequence to correct order.
There is probably not enough information for us to help you here. We'd need to see the report code at least, but better if you can do some debugging to find out more detail about what specific code you have that is causing the trouble.
I'm actually not sure about event order in this specific case, but to troubleshoot you could try with a new blank report to verify the event order in that case and move over one piece of code at a time to find out which line of code causes the event order to change.

Possible to return all events from a Google calendar using FullCalendar?

FullCalendar's clientEvents method returns only the events that are showing on the current page of the calendar. Is there a way to get an array containing all the events from a Google calendar?
Ok. There is most likely a "better" way to do this, but I'll share a workaround I came up with that seems to get the job done.
In the fullcalendar.js file there is a function called fetchEvents. The first two lines of this function set the variables rangeStart and rangeEnd. Simply reset these variables with date objects defining your desired range.

Resources