pnp / List-Formatting

List Formatting Samples for use in SharePoint and Microsoft Lists
https://pnp.github.io/List-Formatting/
MIT License
1.74k stars 833 forks source link

Gantt #400

Open bastienEichenberger opened 2 years ago

bastienEichenberger commented 2 years ago

Hi everyone,

First of all, thank you very much for these resources. It's very appreciated.

I just wonder if it could be possible to improve 2 things in the gantt chart JSON:

Best, Bastien

gdk-max commented 2 years ago

Hi Bastien, Thank you for your suggestions. "to avoid having the field projectStart/projectEnd"
This would be very interesting indeed, and would have been preferable in the first place. Unfortunately the format is always row based, you can not refer to values stored in another row. So I personally don't see a solution there. The projectStart and projectEnd dates are used in every line to calculate the position of bar, so those values really need to be available in every row.

"Include subtask. i.e I could add a column type with the task type [task, subtask]. Then we could sort by task. This would require editing the JSON to manage groupview" I do see what you are suggesting. But the way grouping is working, what you really need to do is add a column called "projectPhase" (or something) and group by these values. Unfortunately we will loose the display of the projectStart and projectEnd for every group because those are only displayed in the first row of the table. Second, the group view itself doesn't really have access to the information in the rows below accept for aggregations like count, average and probably maximum... bur there could be a way of displayin the start +enddate of that phase....

I need some time to get this in a new version... but surely worth the try

Grt Geert

wmunguiam commented 2 years ago

Hello,

I have just test project-gantt-chart in my Sharepoint list but unfortunately I realized it doesn't work if dates are in dd/MM/yyyy format.

I also found that I had to use toString insted toLocaleDateString in order to read data from variables. ( e.g. "txtContent": "=toString([$ProjectStart])"

Finally, if wrong dates are converted to Numbers, formulas crash all the time.

gdk-max commented 2 years ago

Hi wmunguiam, I wrote the sample and I am actually using the dd/MM/yyyy dateformat, so it should be working. Based on your other comments I am actually wondering if the columns are indeed of the Date-type? Could it be that those columns are text columns or something?

Geert

Type Internal Name Required
Single line of text Title Yes
Date ProjectStart Yes
Date ProjectDue Yes
Date TaskStart Yes
Date TaskDue Yes
Number Progress Yes
paobrunelli commented 9 months ago

I am trying to adapt this (very, very nice) list format script to column names that are standard for "Activity" cloumn in the content types in my sites. I have been trying changeing all the occurances of variables in the script, but as soon as I change the first one, the whole page turn to "blank"; what I don't understand is that if I misspell the variable name, only that variable disapperars from the page. I solved with the workaround of creating calculated columns with the original names, made equal to my names, but I'd like to solve the root cause of the problem.... thank you for your help paolo

gdk-max commented 9 months ago

HI @paobrunelli , The reason why it most of the time breaks is because the script (like all List-formatting) refers to the internal name of the column and not the display columnname. You can find tha name in de addressbar when you try (or pretend) to change the (display)name of the column. See screenshots, where it mentions Field=Title image

Because of the calculations it indeed can happen that everything turns weird at the moment that column names don't match. If you tell me what your internal names are for the columns I can make it work on my end.

geert

paobrunelli commented 9 months ago

thank-you geert! with your suggestion I solved the issue (it derived from language setting in the site column definition). I am now planning to insert this view in our project management flow, using well structured sharepoint list made available to the team members, that do not have MS Project. What should be great, would be to have the ability to define, if not task-subtask hierarchy, at least the ability to define a sort of "main task" type, that have a different task bar color and task name in bold. I perfectly understand that with this simple implementation the plan view might easily loose consistency in case of re-ordering the list items, and also main task duration and progress could be inconsistent with the other task, but this task-subtask differentiation at presentation level only, wold be in any case very useful thank you again paolo (paobrunelli)