Premium support for our pure JavaScript UI components


Post by bherford »

I've got

        beforeTaskEditShow({editor}) {
            editor.widgetMap.schedulingModeField.disabled = true
            editor.widgetMap.effortDrivenField.disabled = true
        },

which disables the fields properly, but then when I edit another field, they lose their disabled state. I've attached a video below

disablebug.mov
(7.89 MiB) Downloaded 31 times

Post by marcio »

Hey bherford,

To disable fields, you need to change the configuration object (you can check the documentation here https://www.bryntum.com/docs/gantt/api/Gantt/widget/TaskEditor#task-editor-customization-example):

 features : {
        taskEdit : {
            items : {
                advancedTab : {
                    items : {
                        schedulingModeField : {
                            readOnly : true
                        },
                        effortDrivenField : {
                            readOnly : true
                        }
                    }
                }
            }
        }
    }

Also, we recommend using readOnly instead of disabled for accessibility reasons

Best regards,
Márcio


Post by bherford »

Marcio, thanks for the quick response

I implemented your code snippet - and initially displayed properly, then when I changed another field they became editable again:

Screen Shot 2022-10-06 at 4.45.26 PM.png
Screen Shot 2022-10-06 at 4.45.26 PM.png (123.35 KiB) Viewed 489 times
Screen Shot 2022-10-06 at 4.45.43 PM.png
Screen Shot 2022-10-06 at 4.45.43 PM.png (122.99 KiB) Viewed 489 times

Post by marcio »

Hey bherford,

Could you confirm which version are you using? As you can see in the video, in our latest version demos with that configuration that I shared we don't have that behavior, perhaps you have another configuration that could be causing that behavior, are you able to create a sample configuration for us to check?

Attachments
Bryntum Gantt - Task editor customization demo - 6 October 2022.mp4
(276.99 KiB) Downloaded 29 times

Best regards,
Márcio


Post by bherford »

    "@bryntum/gantt": "^5.1.3",
    "@bryntum/gantt-angular": "^5.1.3",
    

I was able to get the config here in my

gantt.config.js

to work:

        beforeTaskEditShow({editor}) {
            editor.widgetMap.schedulingModeField.readOnly = true
            editor.widgetMap.effortDrivenField.disabled = true
            editor.widgetMap.manuallyScheduledField.disabled = true
            editor.widgetMap.rollupField.disabled = true
        },

by adding this line:

isEditable() {}

to my

task.js

What could be causing this behavior? I'm looking into how to share the project code with you


Post by tasnim »

Yes. We need a runnable test case so that we can debug it and figure out the solution. You can share the project like this

  1. first remove node_modules folder
  2. And then wrap your whole app in a .zip file
  3. Then drag and drop the file into our forum text box
  4. Then submit

Post by bherford »

Even without node_modules this file is too big to upload. here is a link to drive https://drive.google.com/file/d/1MUGpodbyHnXyVO0SgOof7c8QXvRfS3W3/view?usp=sharing


Post by marcio »

Hello bherford,

I got an error when trying to compile that project, could you please update the source code or provide a valid configuration for the project that you shared?

Attachments
Screen Shot 2022-10-11 at 15.13.17.png
Screen Shot 2022-10-11 at 15.13.17.png (79.35 KiB) Viewed 434 times

Best regards,
Márcio


Post by bherford »

Hi Marcio,

I was able to find a workaround by adding


beforeTaskEditShow({editor}) {
            // Define list of fields to disable.
            const disabledAdvancedFields = ['rollupField', 'manuallyScheduledField', 'effortDrivenField', 'schedulingModeField']
            disabledAdvancedFields.forEach(field => {
                // e.g: editor.widgetMap.rollupField.readOnly
                editor.widgetMap[field].readOnly = true
                // Without this class the field looks editable 
                editor.widgetMap[field].cls = 'b-disabled'
            })
        },


Post by tasnim »

That's really great. Glad to hear that.

Good Luck :)


Post Reply