fullcalendar event sorting not working for meChange default event sort order on FullCalendar month ViewHow do I sort a list of dictionaries by a value of the dictionary?Sort a Map<Key, Value> by valuesHow do JavaScript closures work?Event binding on dynamically created elements?How does JavaScript .prototype work?How do I sort a dictionary by value?How do I sort an NSMutableArray with custom objects in it?Sorting an array of JavaScript objects by propertySort array of objects by string property valueHow to sort a dataframe by multiple column(s)

Arrow those variables!

Could gravitational lensing be used to protect a spaceship from a laser?

Is it legal for company to use my work email to pretend I still work there?

I'm flying to France today and my passport expires in less than 2 months

Why is the 'in' operator throwing an error with a string literal instead of logging false?

In a Spin are Both Wings Stalled?

Doing something right before you need it - expression for this?

Blender 2.8 I can't see vertices, edges or faces in edit mode

Forgetting the musical notes while performing in concert

Is the Joker left-handed?

Why can't we play rap on piano?

Can one be a co-translator of a book, if he does not know the language that the book is translated into?

Why do I get two different answers for this counting problem?

Famous Pre Reformation Christian Pastors (Non Catholic and Non Orthodox)

What exploit are these user agents trying to use?

Should I tell management that I intend to leave due to bad software development practices?

A reference to a well-known characterization of scattered compact spaces

Assassin's bullet with mercury

How can I prevent hyper evolved versions of regular creatures from wiping out their cousins?

How badly should I try to prevent a user from XSSing themselves?

90's TV series where a boy goes to another dimension through portal near power lines

intersection of two sorted vectors in C++

What's the difference between 'rename' and 'mv'?

Is there a hemisphere-neutral way of specifying a season?



fullcalendar event sorting not working for me


Change default event sort order on FullCalendar month ViewHow do I sort a list of dictionaries by a value of the dictionary?Sort a Map<Key, Value> by valuesHow do JavaScript closures work?Event binding on dynamically created elements?How does JavaScript .prototype work?How do I sort a dictionary by value?How do I sort an NSMutableArray with custom objects in it?Sorting an array of JavaScript objects by propertySort array of objects by string property valueHow to sort a dataframe by multiple column(s)






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Using fullcalendar v3.8.2. I'm struggling with getting my events to sort. I've read (and re-read) the stackoverflow answer here. I'm using the evenOrder and have tried various options but always getting results like screenshot below. These are "all day" events. This is a boat launch calendar and I always want to show "put ins" before "take outs".



Cleary the events are not ordered by title, nor are they ordered by any of the eventOrder options that I've tried.



screen shot



Currently my code looks like:



 $calendar.fullCalendar({
eventOrder: function(e)
return e.miscProps.sort;
,


With data that looks like:



start: "2019-01-02", title: "30 put ins", className: "putin", sort: "0"
start: "2019-01-16", title: "1 take outs", className: "takeout", sort: "1"


A "putin" event is always a sort:0 and a "takout" is always sort:1 The eventOrder: function() is being called and correctly returning either 0 or 1.



Thank you.










share|improve this question






























    0















    Using fullcalendar v3.8.2. I'm struggling with getting my events to sort. I've read (and re-read) the stackoverflow answer here. I'm using the evenOrder and have tried various options but always getting results like screenshot below. These are "all day" events. This is a boat launch calendar and I always want to show "put ins" before "take outs".



    Cleary the events are not ordered by title, nor are they ordered by any of the eventOrder options that I've tried.



    screen shot



    Currently my code looks like:



     $calendar.fullCalendar({
    eventOrder: function(e)
    return e.miscProps.sort;
    ,


    With data that looks like:



    start: "2019-01-02", title: "30 put ins", className: "putin", sort: "0"
    start: "2019-01-16", title: "1 take outs", className: "takeout", sort: "1"


    A "putin" event is always a sort:0 and a "takout" is always sort:1 The eventOrder: function() is being called and correctly returning either 0 or 1.



    Thank you.










    share|improve this question


























      0












      0








      0








      Using fullcalendar v3.8.2. I'm struggling with getting my events to sort. I've read (and re-read) the stackoverflow answer here. I'm using the evenOrder and have tried various options but always getting results like screenshot below. These are "all day" events. This is a boat launch calendar and I always want to show "put ins" before "take outs".



      Cleary the events are not ordered by title, nor are they ordered by any of the eventOrder options that I've tried.



      screen shot



      Currently my code looks like:



       $calendar.fullCalendar({
      eventOrder: function(e)
      return e.miscProps.sort;
      ,


      With data that looks like:



      start: "2019-01-02", title: "30 put ins", className: "putin", sort: "0"
      start: "2019-01-16", title: "1 take outs", className: "takeout", sort: "1"


      A "putin" event is always a sort:0 and a "takout" is always sort:1 The eventOrder: function() is being called and correctly returning either 0 or 1.



      Thank you.










      share|improve this question
















      Using fullcalendar v3.8.2. I'm struggling with getting my events to sort. I've read (and re-read) the stackoverflow answer here. I'm using the evenOrder and have tried various options but always getting results like screenshot below. These are "all day" events. This is a boat launch calendar and I always want to show "put ins" before "take outs".



      Cleary the events are not ordered by title, nor are they ordered by any of the eventOrder options that I've tried.



      screen shot



      Currently my code looks like:



       $calendar.fullCalendar({
      eventOrder: function(e)
      return e.miscProps.sort;
      ,


      With data that looks like:



      start: "2019-01-02", title: "30 put ins", className: "putin", sort: "0"
      start: "2019-01-16", title: "1 take outs", className: "takeout", sort: "1"


      A "putin" event is always a sort:0 and a "takout" is always sort:1 The eventOrder: function() is being called and correctly returning either 0 or 1.



      Thank you.







      javascript sorting fullcalendar






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 8 at 9:30









      ADyson

      25.5k112746




      25.5k112746










      asked Mar 8 at 0:11









      Richard GreenwoodRichard Greenwood

      174212




      174212






















          1 Answer
          1






          active

          oldest

          votes


















          2














          If you supply a function for eventOrder then, as the eventOrder docs you linked to state, it accepts two input parameters (the two events which need to be compared and sorted), and you are also told that it's supposed to return either -1, 0 or 1 as the result of the comparison - as an indication of which of the two input items should be placed first.



          If the first event should be first in the list, then return -1. If the opposite, then return 1, if they're equal then return 0. The logic within it should be very similar to the sample code provided in the docs for the native JS array sort function - see here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description



          Your logic currently will just return the "sort" value for whichever event happens to be first in the un-sorted list. This is not doing any kind of comparison at all, and it also doesn't supply the full range of possible values the calling code expects (i.e. you only ever return 0 or 1, never -1 - but even if you did it wouldn't necessarily make sense).



          A working comparison function would be:



          eventOrder: function(a, b) 
          var result = 0;
          if (a.miscProps.sort < b.miscProps.sort) result = -1; //event a should be listed first
          else if (a.miscProps.sort > b.miscProps.sort) result = 1; //event b should be listed first
          return result;
          ,


          Demo: http://jsfiddle.net/c9upo8w2/1/



          But...actually you don't need to write a custom function for this as far as I can see, because you're ordering very straightforwardly on the ascending sequence of numbers in the "sort" field alone. There's no complex calculation to be done. Specifying the field on which to sort will do the job perfectly nicely - fullCalendar will do the rest. Again the documentation you linked you states that if you supply the name of a field as the "eventOrder" option then it will sort (otherwise equal) events in ascending order by that field. So:



          eventOrder: "sort"


          is the only thing you need to write.



          Demo: http://jsfiddle.net/c9upo8w2/




          P.S. Just as an aside, the sample data you've given above isn't much use because they're on different days anyway, so the custom sort won't apply. Obviously in this case I was easily able to change it in order to create the demos, but it would make more sense to supply an example which actually reproduces the issue :-)






          share|improve this answer




















          • 1





            Thank you for the detail explanation. I should have read the documentation regarding the use of the function more thoroughly. I'd started playing with the function after other attempts failed, specifically using eventOrder: 'className' which would eliminate my need for "sort". But className is an array, so I started using the function, still no joy (since I hadn't digested the documentation) so I went brute force and added "sort", at which point I guess I had myself pretty well confused. Any elegant way to use className w/o a function?

            – Richard Greenwood
            Mar 8 at 15:58











          • In your data sample, the className field seems to be a string rather than an array. So if you tell it to sort by this field it will do a simple alphabetical sort, which may not be what you want. If you need to look at the values and place them in order based on some other interpretation of the className value then you'll need a custom function.

            – ADyson
            Mar 8 at 16:25











          • I appreciate your help and do not want to waste more of your time. Simply using eventOrder: 'className' does not produce alphabetical sorting. Within eventOrder:function(a,b), "className" is a property of "a" and "b", and it is there that is is an array. Thanks again.

            – Richard Greenwood
            Mar 8 at 17:41











          • Ah ok. The className property from your original data would be within "miscProps" just like "sort" is. The other property perhaps refers to the CSS classes assigned to the event, I would guess (not at a computer to test it right now)

            – ADyson
            Mar 8 at 18:18












          • Right. 'className' is the CSS class assigned to the event. It shows up as an array on the event, not in 'miscProps'. And doesn't seem to work as an eventOrder: value, which is where I started. I was trying to overload it for both style & sorting. But I have learned a lot along the way thanks to your patient assistance.

            – Richard Greenwood
            Mar 9 at 0:24












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55054852%2ffullcalendar-event-sorting-not-working-for-me%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          If you supply a function for eventOrder then, as the eventOrder docs you linked to state, it accepts two input parameters (the two events which need to be compared and sorted), and you are also told that it's supposed to return either -1, 0 or 1 as the result of the comparison - as an indication of which of the two input items should be placed first.



          If the first event should be first in the list, then return -1. If the opposite, then return 1, if they're equal then return 0. The logic within it should be very similar to the sample code provided in the docs for the native JS array sort function - see here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description



          Your logic currently will just return the "sort" value for whichever event happens to be first in the un-sorted list. This is not doing any kind of comparison at all, and it also doesn't supply the full range of possible values the calling code expects (i.e. you only ever return 0 or 1, never -1 - but even if you did it wouldn't necessarily make sense).



          A working comparison function would be:



          eventOrder: function(a, b) 
          var result = 0;
          if (a.miscProps.sort < b.miscProps.sort) result = -1; //event a should be listed first
          else if (a.miscProps.sort > b.miscProps.sort) result = 1; //event b should be listed first
          return result;
          ,


          Demo: http://jsfiddle.net/c9upo8w2/1/



          But...actually you don't need to write a custom function for this as far as I can see, because you're ordering very straightforwardly on the ascending sequence of numbers in the "sort" field alone. There's no complex calculation to be done. Specifying the field on which to sort will do the job perfectly nicely - fullCalendar will do the rest. Again the documentation you linked you states that if you supply the name of a field as the "eventOrder" option then it will sort (otherwise equal) events in ascending order by that field. So:



          eventOrder: "sort"


          is the only thing you need to write.



          Demo: http://jsfiddle.net/c9upo8w2/




          P.S. Just as an aside, the sample data you've given above isn't much use because they're on different days anyway, so the custom sort won't apply. Obviously in this case I was easily able to change it in order to create the demos, but it would make more sense to supply an example which actually reproduces the issue :-)






          share|improve this answer




















          • 1





            Thank you for the detail explanation. I should have read the documentation regarding the use of the function more thoroughly. I'd started playing with the function after other attempts failed, specifically using eventOrder: 'className' which would eliminate my need for "sort". But className is an array, so I started using the function, still no joy (since I hadn't digested the documentation) so I went brute force and added "sort", at which point I guess I had myself pretty well confused. Any elegant way to use className w/o a function?

            – Richard Greenwood
            Mar 8 at 15:58











          • In your data sample, the className field seems to be a string rather than an array. So if you tell it to sort by this field it will do a simple alphabetical sort, which may not be what you want. If you need to look at the values and place them in order based on some other interpretation of the className value then you'll need a custom function.

            – ADyson
            Mar 8 at 16:25











          • I appreciate your help and do not want to waste more of your time. Simply using eventOrder: 'className' does not produce alphabetical sorting. Within eventOrder:function(a,b), "className" is a property of "a" and "b", and it is there that is is an array. Thanks again.

            – Richard Greenwood
            Mar 8 at 17:41











          • Ah ok. The className property from your original data would be within "miscProps" just like "sort" is. The other property perhaps refers to the CSS classes assigned to the event, I would guess (not at a computer to test it right now)

            – ADyson
            Mar 8 at 18:18












          • Right. 'className' is the CSS class assigned to the event. It shows up as an array on the event, not in 'miscProps'. And doesn't seem to work as an eventOrder: value, which is where I started. I was trying to overload it for both style & sorting. But I have learned a lot along the way thanks to your patient assistance.

            – Richard Greenwood
            Mar 9 at 0:24
















          2














          If you supply a function for eventOrder then, as the eventOrder docs you linked to state, it accepts two input parameters (the two events which need to be compared and sorted), and you are also told that it's supposed to return either -1, 0 or 1 as the result of the comparison - as an indication of which of the two input items should be placed first.



          If the first event should be first in the list, then return -1. If the opposite, then return 1, if they're equal then return 0. The logic within it should be very similar to the sample code provided in the docs for the native JS array sort function - see here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description



          Your logic currently will just return the "sort" value for whichever event happens to be first in the un-sorted list. This is not doing any kind of comparison at all, and it also doesn't supply the full range of possible values the calling code expects (i.e. you only ever return 0 or 1, never -1 - but even if you did it wouldn't necessarily make sense).



          A working comparison function would be:



          eventOrder: function(a, b) 
          var result = 0;
          if (a.miscProps.sort < b.miscProps.sort) result = -1; //event a should be listed first
          else if (a.miscProps.sort > b.miscProps.sort) result = 1; //event b should be listed first
          return result;
          ,


          Demo: http://jsfiddle.net/c9upo8w2/1/



          But...actually you don't need to write a custom function for this as far as I can see, because you're ordering very straightforwardly on the ascending sequence of numbers in the "sort" field alone. There's no complex calculation to be done. Specifying the field on which to sort will do the job perfectly nicely - fullCalendar will do the rest. Again the documentation you linked you states that if you supply the name of a field as the "eventOrder" option then it will sort (otherwise equal) events in ascending order by that field. So:



          eventOrder: "sort"


          is the only thing you need to write.



          Demo: http://jsfiddle.net/c9upo8w2/




          P.S. Just as an aside, the sample data you've given above isn't much use because they're on different days anyway, so the custom sort won't apply. Obviously in this case I was easily able to change it in order to create the demos, but it would make more sense to supply an example which actually reproduces the issue :-)






          share|improve this answer




















          • 1





            Thank you for the detail explanation. I should have read the documentation regarding the use of the function more thoroughly. I'd started playing with the function after other attempts failed, specifically using eventOrder: 'className' which would eliminate my need for "sort". But className is an array, so I started using the function, still no joy (since I hadn't digested the documentation) so I went brute force and added "sort", at which point I guess I had myself pretty well confused. Any elegant way to use className w/o a function?

            – Richard Greenwood
            Mar 8 at 15:58











          • In your data sample, the className field seems to be a string rather than an array. So if you tell it to sort by this field it will do a simple alphabetical sort, which may not be what you want. If you need to look at the values and place them in order based on some other interpretation of the className value then you'll need a custom function.

            – ADyson
            Mar 8 at 16:25











          • I appreciate your help and do not want to waste more of your time. Simply using eventOrder: 'className' does not produce alphabetical sorting. Within eventOrder:function(a,b), "className" is a property of "a" and "b", and it is there that is is an array. Thanks again.

            – Richard Greenwood
            Mar 8 at 17:41











          • Ah ok. The className property from your original data would be within "miscProps" just like "sort" is. The other property perhaps refers to the CSS classes assigned to the event, I would guess (not at a computer to test it right now)

            – ADyson
            Mar 8 at 18:18












          • Right. 'className' is the CSS class assigned to the event. It shows up as an array on the event, not in 'miscProps'. And doesn't seem to work as an eventOrder: value, which is where I started. I was trying to overload it for both style & sorting. But I have learned a lot along the way thanks to your patient assistance.

            – Richard Greenwood
            Mar 9 at 0:24














          2












          2








          2







          If you supply a function for eventOrder then, as the eventOrder docs you linked to state, it accepts two input parameters (the two events which need to be compared and sorted), and you are also told that it's supposed to return either -1, 0 or 1 as the result of the comparison - as an indication of which of the two input items should be placed first.



          If the first event should be first in the list, then return -1. If the opposite, then return 1, if they're equal then return 0. The logic within it should be very similar to the sample code provided in the docs for the native JS array sort function - see here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description



          Your logic currently will just return the "sort" value for whichever event happens to be first in the un-sorted list. This is not doing any kind of comparison at all, and it also doesn't supply the full range of possible values the calling code expects (i.e. you only ever return 0 or 1, never -1 - but even if you did it wouldn't necessarily make sense).



          A working comparison function would be:



          eventOrder: function(a, b) 
          var result = 0;
          if (a.miscProps.sort < b.miscProps.sort) result = -1; //event a should be listed first
          else if (a.miscProps.sort > b.miscProps.sort) result = 1; //event b should be listed first
          return result;
          ,


          Demo: http://jsfiddle.net/c9upo8w2/1/



          But...actually you don't need to write a custom function for this as far as I can see, because you're ordering very straightforwardly on the ascending sequence of numbers in the "sort" field alone. There's no complex calculation to be done. Specifying the field on which to sort will do the job perfectly nicely - fullCalendar will do the rest. Again the documentation you linked you states that if you supply the name of a field as the "eventOrder" option then it will sort (otherwise equal) events in ascending order by that field. So:



          eventOrder: "sort"


          is the only thing you need to write.



          Demo: http://jsfiddle.net/c9upo8w2/




          P.S. Just as an aside, the sample data you've given above isn't much use because they're on different days anyway, so the custom sort won't apply. Obviously in this case I was easily able to change it in order to create the demos, but it would make more sense to supply an example which actually reproduces the issue :-)






          share|improve this answer















          If you supply a function for eventOrder then, as the eventOrder docs you linked to state, it accepts two input parameters (the two events which need to be compared and sorted), and you are also told that it's supposed to return either -1, 0 or 1 as the result of the comparison - as an indication of which of the two input items should be placed first.



          If the first event should be first in the list, then return -1. If the opposite, then return 1, if they're equal then return 0. The logic within it should be very similar to the sample code provided in the docs for the native JS array sort function - see here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description



          Your logic currently will just return the "sort" value for whichever event happens to be first in the un-sorted list. This is not doing any kind of comparison at all, and it also doesn't supply the full range of possible values the calling code expects (i.e. you only ever return 0 or 1, never -1 - but even if you did it wouldn't necessarily make sense).



          A working comparison function would be:



          eventOrder: function(a, b) 
          var result = 0;
          if (a.miscProps.sort < b.miscProps.sort) result = -1; //event a should be listed first
          else if (a.miscProps.sort > b.miscProps.sort) result = 1; //event b should be listed first
          return result;
          ,


          Demo: http://jsfiddle.net/c9upo8w2/1/



          But...actually you don't need to write a custom function for this as far as I can see, because you're ordering very straightforwardly on the ascending sequence of numbers in the "sort" field alone. There's no complex calculation to be done. Specifying the field on which to sort will do the job perfectly nicely - fullCalendar will do the rest. Again the documentation you linked you states that if you supply the name of a field as the "eventOrder" option then it will sort (otherwise equal) events in ascending order by that field. So:



          eventOrder: "sort"


          is the only thing you need to write.



          Demo: http://jsfiddle.net/c9upo8w2/




          P.S. Just as an aside, the sample data you've given above isn't much use because they're on different days anyway, so the custom sort won't apply. Obviously in this case I was easily able to change it in order to create the demos, but it would make more sense to supply an example which actually reproduces the issue :-)







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 8 at 9:29

























          answered Mar 8 at 9:24









          ADysonADyson

          25.5k112746




          25.5k112746







          • 1





            Thank you for the detail explanation. I should have read the documentation regarding the use of the function more thoroughly. I'd started playing with the function after other attempts failed, specifically using eventOrder: 'className' which would eliminate my need for "sort". But className is an array, so I started using the function, still no joy (since I hadn't digested the documentation) so I went brute force and added "sort", at which point I guess I had myself pretty well confused. Any elegant way to use className w/o a function?

            – Richard Greenwood
            Mar 8 at 15:58











          • In your data sample, the className field seems to be a string rather than an array. So if you tell it to sort by this field it will do a simple alphabetical sort, which may not be what you want. If you need to look at the values and place them in order based on some other interpretation of the className value then you'll need a custom function.

            – ADyson
            Mar 8 at 16:25











          • I appreciate your help and do not want to waste more of your time. Simply using eventOrder: 'className' does not produce alphabetical sorting. Within eventOrder:function(a,b), "className" is a property of "a" and "b", and it is there that is is an array. Thanks again.

            – Richard Greenwood
            Mar 8 at 17:41











          • Ah ok. The className property from your original data would be within "miscProps" just like "sort" is. The other property perhaps refers to the CSS classes assigned to the event, I would guess (not at a computer to test it right now)

            – ADyson
            Mar 8 at 18:18












          • Right. 'className' is the CSS class assigned to the event. It shows up as an array on the event, not in 'miscProps'. And doesn't seem to work as an eventOrder: value, which is where I started. I was trying to overload it for both style & sorting. But I have learned a lot along the way thanks to your patient assistance.

            – Richard Greenwood
            Mar 9 at 0:24













          • 1





            Thank you for the detail explanation. I should have read the documentation regarding the use of the function more thoroughly. I'd started playing with the function after other attempts failed, specifically using eventOrder: 'className' which would eliminate my need for "sort". But className is an array, so I started using the function, still no joy (since I hadn't digested the documentation) so I went brute force and added "sort", at which point I guess I had myself pretty well confused. Any elegant way to use className w/o a function?

            – Richard Greenwood
            Mar 8 at 15:58











          • In your data sample, the className field seems to be a string rather than an array. So if you tell it to sort by this field it will do a simple alphabetical sort, which may not be what you want. If you need to look at the values and place them in order based on some other interpretation of the className value then you'll need a custom function.

            – ADyson
            Mar 8 at 16:25











          • I appreciate your help and do not want to waste more of your time. Simply using eventOrder: 'className' does not produce alphabetical sorting. Within eventOrder:function(a,b), "className" is a property of "a" and "b", and it is there that is is an array. Thanks again.

            – Richard Greenwood
            Mar 8 at 17:41











          • Ah ok. The className property from your original data would be within "miscProps" just like "sort" is. The other property perhaps refers to the CSS classes assigned to the event, I would guess (not at a computer to test it right now)

            – ADyson
            Mar 8 at 18:18












          • Right. 'className' is the CSS class assigned to the event. It shows up as an array on the event, not in 'miscProps'. And doesn't seem to work as an eventOrder: value, which is where I started. I was trying to overload it for both style & sorting. But I have learned a lot along the way thanks to your patient assistance.

            – Richard Greenwood
            Mar 9 at 0:24








          1




          1





          Thank you for the detail explanation. I should have read the documentation regarding the use of the function more thoroughly. I'd started playing with the function after other attempts failed, specifically using eventOrder: 'className' which would eliminate my need for "sort". But className is an array, so I started using the function, still no joy (since I hadn't digested the documentation) so I went brute force and added "sort", at which point I guess I had myself pretty well confused. Any elegant way to use className w/o a function?

          – Richard Greenwood
          Mar 8 at 15:58





          Thank you for the detail explanation. I should have read the documentation regarding the use of the function more thoroughly. I'd started playing with the function after other attempts failed, specifically using eventOrder: 'className' which would eliminate my need for "sort". But className is an array, so I started using the function, still no joy (since I hadn't digested the documentation) so I went brute force and added "sort", at which point I guess I had myself pretty well confused. Any elegant way to use className w/o a function?

          – Richard Greenwood
          Mar 8 at 15:58













          In your data sample, the className field seems to be a string rather than an array. So if you tell it to sort by this field it will do a simple alphabetical sort, which may not be what you want. If you need to look at the values and place them in order based on some other interpretation of the className value then you'll need a custom function.

          – ADyson
          Mar 8 at 16:25





          In your data sample, the className field seems to be a string rather than an array. So if you tell it to sort by this field it will do a simple alphabetical sort, which may not be what you want. If you need to look at the values and place them in order based on some other interpretation of the className value then you'll need a custom function.

          – ADyson
          Mar 8 at 16:25













          I appreciate your help and do not want to waste more of your time. Simply using eventOrder: 'className' does not produce alphabetical sorting. Within eventOrder:function(a,b), "className" is a property of "a" and "b", and it is there that is is an array. Thanks again.

          – Richard Greenwood
          Mar 8 at 17:41





          I appreciate your help and do not want to waste more of your time. Simply using eventOrder: 'className' does not produce alphabetical sorting. Within eventOrder:function(a,b), "className" is a property of "a" and "b", and it is there that is is an array. Thanks again.

          – Richard Greenwood
          Mar 8 at 17:41













          Ah ok. The className property from your original data would be within "miscProps" just like "sort" is. The other property perhaps refers to the CSS classes assigned to the event, I would guess (not at a computer to test it right now)

          – ADyson
          Mar 8 at 18:18






          Ah ok. The className property from your original data would be within "miscProps" just like "sort" is. The other property perhaps refers to the CSS classes assigned to the event, I would guess (not at a computer to test it right now)

          – ADyson
          Mar 8 at 18:18














          Right. 'className' is the CSS class assigned to the event. It shows up as an array on the event, not in 'miscProps'. And doesn't seem to work as an eventOrder: value, which is where I started. I was trying to overload it for both style & sorting. But I have learned a lot along the way thanks to your patient assistance.

          – Richard Greenwood
          Mar 9 at 0:24






          Right. 'className' is the CSS class assigned to the event. It shows up as an array on the event, not in 'miscProps'. And doesn't seem to work as an eventOrder: value, which is where I started. I was trying to overload it for both style & sorting. But I have learned a lot along the way thanks to your patient assistance.

          – Richard Greenwood
          Mar 9 at 0:24




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55054852%2ffullcalendar-event-sorting-not-working-for-me%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

          Алба-Юлія

          Захаров Федір Захарович