JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Window › Scheduler Resource
- This topic has 4 replies, 2 voices, and was last updated 3 years, 3 months ago by yavordashew.
-
AuthorPosts
-
June 25, 2021 at 10:15 am #101941kboughabaMember
hello,
I’m using doctor’s scheduler with angular, so i added a list of projet in ressources, it means for now in ressources i have a list of user and a list of project, by default user’s list is checked, how can i also check project’s list ?
code :
<pre class=”prettyprint prettyprinted”><span class=”pln”>resources</span><span class=”pun”>:</span> <span class=”typ”>SchedulerResource</span><span class=”pun”>[]</span> <span class=”pun”>=</span> <span class=”pun”>[</span>
<span class=”pun”>{</span><span class=”pln”>
label</span><span class=”pun”>:</span> <span class=”str”>’Doctors'</span><span class=”pun”>,</span><span class=”pln”>
value</span><span class=”pun”>:</span> <span class=”str”>’doctorId'</span><span class=”pun”>,</span><span class=”pln”>
dataSource</span><span class=”pun”>:</span> <span class=”pun”>[</span>
<span class=”pun”>{</span><span class=”pln”>
label</span><span class=”pun”>:</span> <span class=”str”>’Andrew Johnson'</span><span class=”pun”>,</span><span class=”pln”>
id</span><span class=”pun”>:</span> <span class=”lit”>1</span><span class=”pun”>,</span><span class=”pln”>
speciality</span><span class=”pun”>:</span> <span class=”str”>’Anesthesiology'</span><span class=”pun”>,</span><span class=”pln”>
image</span><span class=”pun”>:</span> <span class=”str”>’./../../../src/images/phonebook/andrew.png'</span><span class=”pun”>,</span><span class=”pln”>
backgroundColor</span><span class=”pun”>:</span> <span class=”str”>’#28a745′</span>
<span class=”pun”>}</span>
<span class=”pun”>]</span>
<span class=”pun”>},</span><span class=”pun”>{</span><span class=”pln”>
label</span><span class=”pun”>:</span> <span class=”str”>’Project'</span><span class=”pun”>,</span><span class=”pln”>
value</span><span class=”pun”>:</span> <span class=”str”>’projId'</span><span class=”pun”>,</span><span class=”pln”>
dataSource</span><span class=”pun”>:</span> <span class=”pun”>[</span>
<span class=”pun”>{</span><span class=”pln”>
label</span><span class=”pun”>:</span> <span class=”str”>’Projet1′</span><span class=”pun”>,</span><span class=”pln”>
id</span><span class=”pun”>:</span> <span class=”lit”>1</span>
<span class=”pun”>},</span><span class=”pun”>{</span><span class=”pln”>
label</span><span class=”pun”>:</span> <span class=”str”>’Projet2′</span><span class=”pun”>,</span><span class=”pln”>
id</span><span class=”pun”>:</span> 2
<span class=”pun”>}</span><span class=”pun”>
</span><span class=”pun”> ]</span> <span class=”pun”>}</span>
<pre class=”prettyprint prettyprinted”> <span class=”pun”>];
</span>
<div></div>
<pre class=”prettyprint prettyprinted”><span class=”pun”> </span>June 25, 2021 at 1:09 pm #101942yavordashewMemberHi kboughaba,
I have edited the code snippet that you have shared so that it achieves the functionality you need for your use case.resources: SchedulerResource[] = [ { label: 'Doctors', value: 'doctorId', dataSource: [ { label: 'Andrew Johnson', id:1, speciality: 'Anesthesiology', image: '../../../images/phonebook/andrew.png', backgroundColor: '#28a745' } ] }, { label: 'Project', //Instead projectId we set it to doctorId value: 'doctorId', dataSource: [ { label: 'Projet1', id:1 }, { label: 'Projet2', id: 2 } ] } ];
If you set the value of the resource to
doctorId
like in our case the project list will be ‘checked’ too.
Let me know if that works for you!
Please, do not hesitate to contact us if you have any additional questions.
Best regards,
Yavor Dashev
Smart UI Team
https://www.htmlelements.com/June 25, 2021 at 1:49 pm #101943kboughabaMemberit works, thank you, but how can i get the id of my project since it is attributed to doctor’s id ?
June 29, 2021 at 2:20 pm #101954kboughabaMemberHello,
I didn’t get any answer for my second question please !
also i have another problem with [views] in html code, i’ve already tested this link and it’s not working “https://www.htmlelements.com/forums/topic/errors-while-installation/” .
i’m having the error ” ” Type ‘object | string[]’ is not assignable to type ‘SchedulerViews’. Type ‘object’ is not assignable to type ‘SchedulerViews’. Type ‘object’ is not assignable to type ‘”timelineMonth”‘. ” for both [view]=”view” and [views]=”views” ”
thank you.June 30, 2021 at 1:58 pm #101958yavordashewMemberHi kboughaba,
It will be best to share a bit more context of the use case of the Type error you are getting – the best is to create a code example which reproduces is in order to be able to give you a solution about it.
For the question before, take my apologies for missing it.
You have to define in the projectId in Scheduler in the SchedulerDataSource like so-dataSource: SchedulerDataSource[] = (() => { const today = new Date(), currentYear = today.getFullYear(), currentMonth = today.getMonth(), currentDate = today.getDate(), data = [ { label: 'Prescribe and/or administer treatment and medication', doctorId: 3, dateStart: new Date(currentYear, currentMonth, currentDate + 3, 9, 20), dateEnd: new Date(currentYear, currentMonth, currentDate + 3, 10, 35) }, { label: 'Monitor the cognitive side effects of medication', doctorId: 3, dateStart: new Date(currentYear, currentMonth, currentDate + 4, 10, 20), dateEnd: new Date(currentYear, currentMonth, currentDate + 4, 13) }, { label: '1111111Order supportive care services for patients', projectId: 2, dateStart: new Date(currentYear, currentMonth, currentDate - 4, 9), dateEnd: new Date(currentYear, currentMonth, currentDate - 4, 11, 15) }, { label: '222222Participate in neuroscience research activities', projectId: 1, dateStart: new Date(currentYear, currentMonth, currentDate - 3, 9), dateEnd: new Date(currentYear, currentMonth, currentDate - 3, 11, 15) }]
And then you can use it in the SchedulerResource like so:
resources: SchedulerResource[] = [ { label: 'Project', value: 'projectId', dataSource: [ { label: 'Projet1', id:1 }, { label: 'Projet2', id: 2 } ] } ];
Please, do not hesitate to contact us if you have any additional questions.
Best regards,
Yavor Dashev
Smart UI Team
https://www.htmlelements.com/ -
AuthorPosts
- You must be logged in to reply to this topic.