Premium support for our pure JavaScript UI components


Post by outputlogic »

Hi all.

Just wondering whether it is possible to change a SchedulingModePicker's selected item programmatically.

We currently have the following TaskEditor on our Gantt:

taskEdit: {
    items: {
        advancedTab: {
            items: {
                schedulingModeField: {
                    allowedModes: 'Normal,FixedDuration',
                    listeners: {
                        change: ({ value, oldValue }) => {
                            const effortDrivenCheckbox = source.nextSibling.input;

                            if (value === 'Normal' && oldValue === 'FixedDuration') {
                                effortDrivenCheckbox.checked = false;
                            } else if (value === 'FixedDuration' && oldValue === 'Normal') {
                                effortDrivenCheckbox.checked = true;
                            }
                        }
                    }
                },
                effortDrivenField: {
                    listeners: {
                        change: ({ checked, source }) => {
                            if (checked) {
                                // What to put here to change the scheduling mode to 'Fixed Duration'??
                            } else {
                                // What to put here to change the scheduling mode to 'Normal'??
                            }
                        }
                    }
                }
            }
        }
    }
}

As you can see, we want to limit the available scheduling modes to 'Fixed Duration' (with 'Effort Driven' enabled) and 'Normal' (not effort driven) but have no idea how to write the effortDrivenField.change handler.

MTIA for any advice given :-)


Post by tasnim »

Hi,

You could achieve this by changing https://bryntum.com/products/gantt/docs/api/SchedulerPro/widget/SchedulingModePicker#config-value field

effortDrivenField : {
    listeners : {
        change : ({ checked, source : { parent : { widgetMap : { schedulingModeField } } } }) => {
            if (checked) {
                // What to put here to change the scheduling mode to 'Fixed Duration'??
                schedulingModeField.value = 'Fixed Duration';
            }
            else {
                // What to put here to change the scheduling mode to 'Normal'??
                schedulingModeField.value = 'Normal';
            }
        }
    }
}

This should be working for you.


Post Reply