c# - Changing background-color of event in jquery full calendar -
i have web application ( asp.net mvc4 ) in used jquery full calendar
site .
<script> $(document).ready(function () { var date = new date(); var d = date.getdate(); var m = date.getmonth(); var y = date.getfullyear(); var tab = []; var d1 = []; var m1 = []; var y1 = []; var d2 = []; var m2 = []; var y2 = []; var colors = []; @for(int =0; i< @model.get_list_tache().count;i++){ @: d1.push(@model.get_list_tache()[i].begin_date.day); @: m1.push(@model.get_list_tache()[i].begin_date.month); @: y1.push(@model.get_list_tache()[i].begin_date.year); @: d2.push(@model.get_list_tache()[i].end_date.day); @: m2.push(@model.get_list_tache()[i].end_date.month); @: y2.push(@model.get_list_tache()[i].end_date.year); } d1.reverse(); m1.reverse(); y1.reverse(); d2.reverse(); m2.reverse(); y2.reverse(); @for(int =0; i< @model.get_list_tache().count;i++){ @:var e = { title: "tache: @model.get_list_tache()[i].tache_description", start: new date(y1.pop(), m1.pop() - 1, d1.pop(), 08, 00), end: new date(y2.pop(), m2.pop() - 1, d2.pop(), 18, 00), allday: true}; @: tab.push(e); } $('#calendar').fullcalendar({ theme: true, header: {left: 'prev,next today',center: 'title',right: 'month,agendaweek,agendaday'}, editable: true, events: tab }); }); @for (int = 0; < @model.getcolors().count; i++) { } </script>
i have list of colors in model getcolors()
public list<string> getcolors() { sa_group sadmin = new sa_group(); equipe _equipe = new equipe(); list<string> _out = new list<string>(); list<tache> liste_initiale = _equipe.get_list_tache(); foreach (tache t in liste_initiale) { if (t.id_tache_status == 1) { _out.add("red"); } if (t.id_tache_status == 2) { _out.add("green"); } if (t.id_tache_status == 3) { _out.add("black"); } } return _out; }
so, need change background-color
each element in events
values of getcolors()
.
how can task? suggestions?
hi lamloumi has can see in event object properties there classname can set in every event wich allows define each event css class, , define each color each type of event background color in css. if colors dynamic mean if not same can use jquery or javascript change "on fly" css class.
if need further explanation please let me know.
live long , prosper.
Comments
Post a Comment