-
Notifications
You must be signed in to change notification settings - Fork 835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Property - RadzenMultiDayView->AdvanceDays #1855
Conversation
Hi @paulo-rico, I am not sure how to respond to this PR to be honest :) It is a combination of a PR and questions that seem unrelated. In general if you want a child component to update its parent (which is where the title is rendered) one needs to invoke a method of the parent. Blazor in general won't update a parent if its child changes. This is why I think the title doesn't update when you check a property of a view. The Change event of RadzenSelectBar seems to work just fine:
This works as expected in our demo. We will update the demo to show that. |
Hi @akorchev Yeah, I did go off at various tangents with this one :) Although not related to the component in the PR, the notes were issues with other components I came across while creating the demo. Ignore the notes for now. I'll raise them in a GitHub Issue. BTW, I did get Thanks and regards |
To answer your question about why StateHasChanged() or scheduler.Reload() is needed: You update a child component of the scheduler (the RadzenMultiDayView's AdvanceDays for example). This won't by itself make the scheduler render again as it doesn't update an attribute of the scheduler. You have to either call Reload() (which in effect does StateHasChanged() internally) or call the page's StateHasChanged() method (which also makes the scheduler to render again). The ideal solution is to listen for changes in the child and update the parent. A similar thing is done in RadzenChart - check the ChartComponentBase for example. If a property that affects the parent component is updated we have to refresh it manually. |
Thanks Atanas, I'll have a look at that.
Although, again, not related to the component in the PR (sorry :) ), I tried using the |
It is easily missed, but it does show on your post. This is just to do with the Title of the Scheduler. Everything else updates correctly. The only time one year should be shown, is with January. Any other month will show a from and to, which could be last year to this year, or this year to next year, depending on the current date. When you change to January (after changing to another month) using the When you change to January using the |
No idea why this happens as the code which triggers the change event is quite similar. You can debug it though. |
I'll leave this PR as is, as it has nothing to do with I'll try and debug what the difference between the Stay well and speak soon |
Thanks. Merging this now. |
Rather than hardcoding how many days this view will Advance or Retract, currently set to equal the
NumberOfDays
displayed, this is a new property that allows you to set it explicitly.Additional changes
DaySlotEvents
. Now rectified.NumberOfDays
slider is changed, it will callStateHasChanged()
rather than reloading the Schedule (see notes below)NOTES (let me know if you want me to raise issues for these)
Everything about the
RadzenScheduler
updates fine, with the exception of the title. This can be highlighted on the demo with the year views. Selecting a newStartMonth
using theRadzenSelectBar
updates all but the title. If January is selected, it should just show the current year. Any other month will show from and to. If you switch between, you will see that the title is one step behind, i.e.Would address it but I've not been successful in my attempts. Been getting out of memory errors. Obviously, my attempts at inserting
StateHasChanged
in certain places has caused some sort of infinite loop!For the
NumberOfDays
slider, I callStateHasChanged
on theChange
event to rectify this. Sure that this shouldn't be required and be part of the component.Also, for the life in me, I couldn't get the
Change
event working on theRadzenSelectBar
. May need looking into (the demo page has a section "Get and Set the value of SelectBar using Value and Change event" that doesn't seem to demonstrate this).Regards
Paul