Our state of the art Gantt chart


Post by isadogan »

Hi,

In edit task modal, resources tab; I want to set "Seviye" field as required.

Any way to do this?

Thanks

Attachments
ss1.png
ss1.png (19.89 KiB) Viewed 140 times

Post by marcio »

Hey isadogan,

You can set the editor to use a field that is required like this

features : {
        taskEdit : {
            items : {
                // add custom Resources tab to the third position
                resourcesTab : {
                    title  : 'Resources',
                    items  : {
                        grid : {
                            columns : {
                                data : {
                                    seviye : {
                                        text   : 'Seviye',
                                        editor : { required : true }
                                    }
                                }
                            }
                        }
                    }
                }
Attachments
Screenshot 2023-03-31 at 13.58.37.png
Screenshot 2023-03-31 at 13.58.37.png (95.37 KiB) Viewed 137 times

Best regards,
Márcio


Post by isadogan »

Hi marcio,

Thank you for your response.

Actually, I've already tried this before posting this, but it didn't work :/

Here is an example by using your advanced demo:

features : {
        baselines : {
            disabled : true
        },
        dependencyEdit : true,
        filter         : true,
        labels         : {
            left : {
                field  : 'name',
                editor : {
                    type : 'textfield'
                }
            }
        },
        parentArea : {
            disabled : true
        },
        progressLine : {
            disabled   : true,
            statusDate : new Date(2019, 0, 25)
        },
        rollups : {
            disabled : true
        },
        rowReorder : {
            showGrip : true
        },
        timeRanges : {
            showCurrentTimeLine : true
        },
        fillHandle    : true,
        cellCopyPaste : true,
        taskCopyPaste : {
            allowNativeClipboard : true
        },
taskEdit: {
          items: {
            resourcesTab: {
              items: {
                grid: {
                  columns: {
                    data: {
                      titleLevel: {
                        text: "SEVİYE",
                        field: "titleLevelId",
                        renderer: (props) => {
                          // display the name in the cell
                          const value = props.column.editor.store.data.find(
                            (item) => item.id === props.value
                          );
                          return value?.name;
                        },
                        editor: {
                          type: "combo",
                          valueField: "id",
                          displayField: "name",
                          required: true,
                          store: {
                            idField: "id",
                            data: [{id:1, name:"test 1"}, {id:2, name:"test 2"}],
                          },
                        },
                      },
                    },
                  },
                },
              },
            },
          },
        },
    },

Post by Animal »

When you say "doesn't work"...

The field actually gets its required config set to true? You can interrogate the field to check that.

But you can still probably terminate the edit with the field in an "invalid" state. The next thing is how the cell editing should behave when its editor field is in an invalid state. That is through this: https://www.bryntum.com/products/grid/docs/api/Grid/column/Column#config-invalidAction


Post Reply