а

Gantt, resource, caneldar


#1

If i use calendar(gantt.setWorkTime) in resource_panel, its counting hours by self, or i should do that? Like, set time 4 hours to task
$task = [‘id’=>1, ‘calendar_id’=> 1, ‘owner’=>‘john’];
$calendar = [‘id’=> 1, ‘hours’=> 4]

In resource panel it will count themselves or i should do that ? Cant clearly understand or find informtion.
Trying on this example https://docs.dhtmlx.com/gantt/samples/10_layout/02_resource_panel.html


#2

One more question, can i change calendar on some dates, like 1 october work 8 hours, 2 october 2 hours and so on, coz i see only day of weeks


#3

Hello,
The resource view itself doesn’t calculate the hours. You need to add your code to do that.
In our examples, the hours in the grid are calculated in the resourceConfig variable that is used in the gantt.config.layout property.
The hours in the resource timeline are calculated in the resource_cell_value template:
https://docs.dhtmlx.com/gantt/api__gantt_resource_cell_value_template.html


Here is a simpler snippet with the resource view implementation:
https://snippet.dhtmlx.com/1a5a1b5d5

If you want to specify the values and display them in the resource view, you need to add custom code to calculate that.
Here are the samples with that functionality:
https://docs.dhtmlx.com/gantt/samples/11_resources/12_work_and_material_resources.html
https://docs.dhtmlx.com/gantt/samples/11_resources/09_resource_histogram.html
https://docs.dhtmlx.com/gantt/samples/11_resources/10_resource_histogram_workload_percents.html
https://docs.dhtmlx.com/gantt/samples/11_resources/11_resource_histogram_display_tasks.html

Here are other samples that might help you to implement your solution:
https://snippet.dhtmlx.com/2548caf68
https://snippet.dhtmlx.com/397c7d4db


One more question, can i change calendar on some dates, like 1 october work 8 hours, 2 october 2 hours and so on, coz i see only day of weeks

Yes, you can set the working or non-working time for certain dates. That can be specifyied by using the setWorkTime method:
https://docs.dhtmlx.com/gantt/api__gantt_setworktime.html

gantt.getCalendar("custom1").setWorkTime({date:new Date(2019,03,01), hours:[8,12]});

In the following snippet, task #2 has the working hours for 01 April from 08 to 12:
http://snippet.dhtmlx.com/6ca15c1f6

And here is another snippet, where the dates are generated from strings:
https://snippet.dhtmlx.com/af84253ae


#4

Yes, that’s wht i needed, thx for help