5

I am using fullcalendar in one of my Rails projects to render events on calendar.

The jsfiddle shows the scenario.

I am able to adjust the width but it does not modify the position of events in the same row next to each other. Is there a callback or method which would adjust the position of events when the width is modified

naren
  • 937
  • 1
  • 6
  • 21

1 Answers1

7

Take a look at this fiddle: http://jsfiddle.net/100thGear/jRFYE/

I used the eventRender callback to alter the offset of the next event(s). Hope this helps and gives you an idea of how to proceed.


Why don't you use the className attribute of the event object to set this? You could set the width in the CSS class you are passing to this attribute.

ganeshk
  • 5,583
  • 3
  • 27
  • 31
  • I did use the className attribute .fc_width{width: 100px !important;} to adjust the height but as the position of event is calculated and the left position is set.className width overrides the actual width and the left position is not adjusted. – naren Apr 20 '12 at 16:50
  • 1
    Can you post the code? Or maybe post it on jsfiddle and share the link? – ganeshk Apr 21 '12 at 00:44
  • Great. sloved very simply I need to get more hands on jquery. will wait for possible answers before I accept yours. Thank you – naren Apr 25 '12 at 06:36
  • Ganesh. If you see the weekView of your http://jsfiddle.net/100thGear/jRFYE/ events seems to be rendered not within the same day. I know that you have not considered the day while setting the left position. So if you to considered setting position in WeekView how would you do that – naren Apr 26 '12 at 19:03
  • 1
    I updated my fiddle with some changes for this: http://jsfiddle.net/100thGear/jRFYE/ It gets tricky when you need to edit the way the calendar itself is formed - as compared to editing the position of events. Take a look at the commented code - it is not perfect, but can be a starting point. Do note that when you start editing the content of a widget after it is rendered, things can get out of hand. Also, your edits might not be compatible with future versions. Forking the source and editing it to your needs is better I think. – ganeshk Apr 27 '12 at 04:05
  • Thanks. I agree with you when there are many events like at different times of the day then index of events varies, So I think simple check of previous event might not work, I need to check at time stamp of event. I am trying to figure out a mapping b/w events and index to so that I can check to adjust the width. Other option might be to fork and make changes to render events adjusted to fixed width – naren Apr 27 '12 at 17:39
  • I am trying to achieve something like http://stackoverflow.com/questions/3600039/fullcalendar-mulitple-user-view – naren Apr 27 '12 at 17:55
  • how it works in my case? I have source from third party api and it is not sorted in sequence. so If i change event sequence then it won't works. Check the fiddle : http://jsfiddle.net/jRFYE/385/ – Yatin Mistry Feb 25 '15 at 06:19