Our state of the art Gantt chart


Post by radhakrishnan.y »

Hi
Am using the below code to get the user selected value from combo

{
                    type         : 'combo',
                    label        : 'View By',
                    editable     : false,
                    width        : '20em',
                    displayField : 'name',
                    value        : 1,
                    store        : {
                        data : [
                            {
                                id   : 1,
                                name : 'Unit',
                            },
                            {
                                id   : 2,
                                name : 'Feature',
                            }
                        ]
                    }
                }

Post by tasnim »

You can use https://bryntum.com/docs/gantt/api/Core/widget/Combo#event-select event to get the selected value.
It is gonna fire when an item is selected.

{
                    type         : 'combo',
                    label        : 'View By',
                    editable     : false,
                    width        : '20em',
                    displayField : 'name',
                    
// code below listeners : { select(event) { console.log(event.record); } }, value : 1, store : { data : [ { id : 1, name : 'Unit', }, { id : 2, name : 'Feature', } ] } }

Post by radhakrishnan.y »

Thanks it is working.
How do I load new JSON data into task after I selected the dropdown


Post by tasnim »

Hi,

... load new JSON data into task ...

Sorry, I don't understand what you mean by that. Could you please explain a bit further?


Post by radhakrishnan.y »

After the dropdown is selected, We have to get all the task data from the this.gantt and do some manipulation and feed it again to this.gantt


Post by tasnim »

Here is an example of how you can load it.

                {
                    type         : 'combo',
                    ref          : 'projectSelector',
                    label        : 'Choose project',
                    editable     : false,
                    width        : '20em',
                    displayField : 'name',
                    value        : 1,
                    store        : {
                        data : [
                            {
                                id   : 1,
                                name : 'Launch SaaS',
                                url  : '../_datasets/launch-saas.json'
                            },
                            {
                                id   : 2,
                                name : 'Build web app for customer',
                                url  : '../_datasets/tasks-workedhours.json'
                            }
                        ]
                    },
                    listeners : {
                        select({ record }) {
                        	this.gantt.project.load(record.url);
                        }
                    }
                }

Post Reply