Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to filter a very big json string without looping every object in it?
    primarykey
    data
    text
    <p>I'm currently developing a calendar with all standard views (day, week, month).</p> <p>To load my calendar events I use JSON. When the events are loaded I have to map them on the active view (day, week or month).</p> <p>For each view I only need a particular set of events, the events between the date range of the current view (=timeframe). </p> <p>So, is it possible to filter the events (on date) for each view without looping through the whole JSON object?</p> <p>Now I'm doing this:</p> <pre><code>$(eventCache.Events).each(function() { //CHECK IF THIS EVENT SHOULD BE DISPLAYED }); </code></pre> <p>But the list of events can get up to a couple of hundred so this method is slowing down the performance of the calendar...</p> <p>This is an example of my data:</p> <pre><code>{ "d":{ "__type":"GetEventsCacheResult", "Events":[ { "Subject":"Subject", "CalendarId":"139c9edd-b01b-47cf-bae9-18f3e3dca655", "ColorCode":"#093647", "Id":"0dab7ad9-46c7-e230-294e-0933e78eadae", "Description":null, "DTStartDate":" \/Date(1244596500000)\/", "DTEndDate":"\/Date(1244610000000)\/", "StartDate":"10/06/2009 1:15:00", "EndDate":"10/06/2009 5:00:00", "AppointmentType":0, "AllDay":false }, { "Subject":"Subject", "CalendarId":"139c9edd-b01b-47cf-bae9-18f3e3dca655", "ColorCode":"#093647", "Id":"0fddb3a0-65f1-08c7-daf2-13da605b499b", "Description":null, "DTStartDate":" \/Date(1245823200000)\/", "DTEndDate":"\/Date(1245832200000)\/", "StartDate":"24/06/2009 6:00:00", "EndDate":"24/06/2009 8:30:00", "AppointmentType":0, "AllDay":false }, { "Subject":"Subject", "CalendarId":"139c9edd-b01b-47cf-bae9-18f3e3dca655", "ColorCode":"#093647", "Id":"a95b8a2b-7c8a-677f-dc58-1c9836d72748", "Description":null, "DTStartDate":" \/Date(1247633100000)\/", "DTEndDate":"\/Date(1247646600000)\/", "StartDate":"15/07/2009 4:45:00", "EndDate":"15/07/2009 8:30:00", "AppointmentType":0, "AllDay":false } ], "Dates":{ "StartDate":"\/Date(1238022000000 )\/", "EndDate":"\/Date(1285106400000)\/" } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload