I’m setting up the initial values in my event window.
The event window is not showing the default value at all.
It always shows the first item of the dropdownbox
The code is like this:
Do you use trial version of the library? This bug appeared in one of the recent builds and should be fixed now. Try to redownload the component
yes we’re still using the trial.
I’ll re-download the package
Still having the issue, the package is named: Scheduler.Net-EVAL121016
Another problem I’m facing is that when an user saves a new event and the lightbox form closes, it doesn’t update the event header on the scheduler page.
I have to refresh the page (hitting “f5”)
here’s my code
public ActionResult Index(string txtAgendaFilter)
{
if (!this.Request.IsAuthenticated)
return RedirectToAction("LogOn", "Account");
var sched = BindData(txtAgendaFilter);
return View(sched);
}
private DHXScheduler BindData(string txtAgendaFilter)
{
var context = new AgendeDataContext();
var sched = new DHXScheduler(this);
InitGrid(sched, txtAgendaFilter, context);
var events = GetEventData(txtAgendaFilter, context);
sched.Data.Parse(events);
return sched;
}
private void InitGrid(DHXScheduler sched, string txtAgendaFilter, AgendeDataContext context)
{
sched.Templates.event_header = "{titolo}";
//localizzazione
sched.Localization.Set(SchedulerLocalization.Localizations.Italian);
//Agende - header colonne
var agendeLabels = GetAgendaLabels(txtAgendaFilter, context);
//Aggiungo lo unit view delle agende
var unit = new UnitsView("Agende", "AgendaId");//initialize 'agenda' view
unit.Label = "Agende";
unit.AddOptions(agendeLabels);
unit.Size = 10;//size = identifica quante agende visualizzare nella unitview
sched.Views.Add(unit);
SchedulerControls(sched, context, agendeLabels);
//posizione tab
InitTabPosition(sched);
sched.InitialView = "week";
sched.InitialDate = DateTime.Now;
sched.Config.time_step = 1;
//Prevengo la cache del browser
sched.Data.Loader.PreventCache();
sched.PreventCache();
//Abilito i tooltip
sched.Extensions.Add(SchedulerExtensions.Extension.Tooltip);
sched.InitialDate = DateTime.Now;
sched.EnableDataprocessor = true;
sched.InitialValues.Add("user_id", (Guid)Membership.GetUser().ProviderUserKey);
}
private static void SchedulerControls(DHXScheduler sched, AgendeDataContext context, IQueryable<Models.Agende> agendeLabels)
{
//////////////////////////////////////
//il lightbox è l'editor degli eventi!
//////////////////////////////////////
//aggiungo la gestione degli eventi ricorrenti, deve andare prima del minicalendar perchè se no crea problemi di visualizzazione sulle ricorrenze!
var recurringEvents = new LightboxRecurringBlock("rec_type", "Ricorrenze");
sched.Lightbox.Add(recurringEvents);
var time = new LightboxMiniCalendar("time", "Orario evento");
sched.Lightbox.Add(time);
//aggiungo al lightbox una combo per
var agendeDropDown = new LightboxSelect("AgendaId", "Agende");
agendeDropDown.AddOptions(agendeLabels);
sched.Lightbox.Add(agendeDropDown);
//case code
var caseCode = new LightboxText("caseCode", "Case code");
caseCode.Height = 30;
sched.Lightbox.Add(caseCode);
//numero pratica TAF
var numeroPraticaTAF = new LightboxText("numeroPraticaTaf", "Numero Pratica Taf");
numeroPraticaTAF.Height = 30;
sched.Lightbox.Add(numeroPraticaTAF);
var textBox = new LightboxText("text", "Descrizione");
sched.Lightbox.Add(textBox);
//utente inserimento
var utenteDropDown = new LightboxSelect("user_id", "Utente");
utenteDropDown.AddOptions(context.aspnet_Users.ToList());
sched.Lightbox.Add(utenteDropDown);
var colorDropDown = new LightboxSelect("color", "Colore");
colorDropDown.AddOptions(context.Colors.ToList().OrderBy(x => x.label));
sched.Lightbox.Add(colorDropDown);
}
BTW I have a custom event header:
sched.Templates.event_header = “{titolo}”;
Make sure that latest dll is used(try cleaning solution or maybe manually deleting /bin folder).
I’ve just checked available version of the library, initial values seems working there. i’ve added this code to the basic sample and everything worked as expected(‘titolo’ property had initial value of ‘default’, updated in the header correctly)
sched.Lightbox.Add(new LightboxText("titolo"));
sched.InitialValues.Add("titolo", "default");
sched.Templates.event_header = "{titolo}";
Maybe there any error messages in browser console?
To clarify I used the latest dll, but I used the old javascript (September release)
I’ll use everything from the new release.
I’ll run some other tests
Maybe I wasn’t clear enough:
Once I save data and event form closes, it updates just the event message not the header (see pic1).
It seems that save is not triggering the header change, while event description is updated.
The only thing I did was to set the initial value like I said before
sched.Templates.event_header = "{titolo}";
Should I write some other code? client-side?
Can you attach a working demo project, so we could test the issue there?
I managed to understand why is not working.
Let’s say we have this table “Agenda”:
My lightbox has a LightboxSelect containing all data from “Agenda” table.
Since “Event” table has just “AgendaId” field, my datacontext (the one the scheduler is binded to) has a join with “Agenda” to use “Titolo” as the event header.
if I change value on the dropdownlist, client-side is not updating this property:
But if I create a LightBoxText and map it to “Titolo” everything is working fine.
So how can I update “Titolo” property without using a LightTextBox, I want it to update directly from the option selected on the DropdownList.
Understood. In this case title has to be picked manually, you’ll need to define template on the client to do it. Check the attached sample
DropdownHeader.zip (1.07 MB)
Thanks it’s working now