My goal is to add functionality to this chart to allow the user to enter new items or change the time frame, etc. I am confused how this is done. I have tried editing the block in the custom component but either I am doing it wrong, or it is not the right approach.
I notice that there seems to be JS linked from an external source at the top, I am curious if this source code is the only way to make this functional.
I appreciate any help. I am more so using this chart as an example for a bigger project.
How to design the UI to build that task data is then up to you! You might, for instance, try having a table with a column for each task property along with a project id and then manipulating that data using Retool's normal flows for reading/writing to databases.
Let me know what additional questions that raises!
I'm working on a similar project using a postgreSQL backend. I want to see a gantt chart for each project I have in the database, instead of hardcoding them in the task array. From what I am seeing, you have to create a new array for each project, but I want to do this automatically.
if I have 10 projects, I'd like to see 10 arrays with each element mapped to the proper column in my database. Whenever I add a new project (through a form or w/e), I want that to automatically add a new record, too.
Is your idea to show those charts simultaneously or be able to switch between them?
Since you're passing the task list to your custom component via the component's model you can construct the array however you'd like within your app. For instance, you could write a JS query and pass the following to your model:
{
tasks: {{yourJsQuery.data}}
}
The same could be done by adding a transformer to your PostgreSQL query and passing that data in, etc.
Dynamically generating multiple charts is a bit trickier as you'd need to create separate HTML elements for each chart. Say you pass in an array of tasks lists instead you can try using the following as a basis for doing so: