Our state of the art Gantt chart


Post by rahulranjan »

Hi
1. I want to add validation in task Editor for custom Fields with custom message.
2. How can i add custom fields above Dates data sets.
3. How can show the values of fields when retrieved from DB

Post by arcady »

rahulranjan wrote: Tue Aug 06, 2019 11:52 am Hi
1. I want to add validation in task Editor for custom Fields with custom message.
Listen to Gnt.widget.taskeditor.TaskEditor#validate event and add your custom validation there.
rahulranjan wrote: Tue Aug 06, 2019 11:52 am 2. How can i add custom fields above Dates data sets.
Gnt.widget.taskeditor.TaskEditor docs introduction has "Extending the General field set" chapter which demonstrates adding a field to the "General" tab. The only thing it appends a custom field ..and you want to insert it.
To achieve what you want use insert method instead of add. Something like that:
   // extend standard TaskForm class
   Ext.define('MyTaskForm', {
       extend : 'Gnt.widget.taskeditor.TaskForm',

       constructor : function(config) {
           this.callParent(arguments);

           // insert some custom field at index 2
           this.insert(2, {
               fieldLabel  : 'Foo',
               name        : 'Name',
               width       : 200
           });
       }
   });

    // Let task editor know which class to use
    Ext.create('Gnt.widget.taskeditor.TaskEditor', {
       // to use MyTaskForm to build the "General" tab
       taskFormClass : 'MyTaskForm'
   });
Check in debugger what index to use to get the field to proper place.
rahulranjan wrote: Tue Aug 06, 2019 11:52 am 3. How can show the values of fields when retrieved from DB
All model fields are automatically filled with data ..as soon as values of "name" config of the form fields match their model field names.

Post by arcady »

oops ..sorry I haven't noticed that the question referred Bryntum Gantt (non Ext JS version)
sorry! :)

Post by rahulranjan »

Hi
I didn't get it
Q1.
This is the extra custom field in Task Editor
{
              type: "textfield",
              ref: "plannedScopeField",
              name: "plannedScope",
              label: "planned Scope ",
              flex: "1 0 50%",
              cls: "b-inline"
            },
I want some validation in it like it can not be more than 100 or less than 0
Default value should be 0 . Custom error message. if enter more than 100 or less than 0 .
If validation fails then save button should be disabled.

Q2. I want to load values from DB as drop down in below filed which opening the Task editor
    {
              type: "textfield",
              ref: "uomField",
              name: "uom",
              label: "UOM",
              flex: "1 0 50%",
              cls: "b-inline"
            },
Default selected value will be the first one of drop down. if any values is selected and saved then that value should be show as selected

Post by pmiklashevich »

In the first case please use numberfield instead of textfield. See min/max configs.

In the second case please use combo. Load data to the store which is used in this combo in advance.

Default data in both cases should be applied to your record when it's created (see defaultValue in Model definition) and before task editing begins.

Pavlo Miklashevych
Sr. Frontend Developer


Post by rahulranjan »

Can you let me know one example how to do in combo.
Below is the field i want to load values in that and show the save value in filed.

 {
              type: "textfield",
              ref: "uomField",
              name: "uom",
              label: "UOM",
              flex: "1 0 50%",
              cls: "b-inline"
            },

Post by pmiklashevich »

Please look at this docs: https://www.bryntum.com/docs/scheduler/#Common/widget/Combo
Please pay attention to its type. It's "combo":
2019-08-20_0931.png
2019-08-20_0931.png (183.08 KiB) Viewed 1936 times
Also please pay attention to the code snippets in the docs. It has a number of examples which show how combo can be configured. items or store should be used to specify options.

Also you can check out examples/eventeditor/app.js to see how we configure combo in Event Editor demo:
....}, {
    type  : 'combo',
    name  : 'eventType',
    label : 'Type',
    index : 2,
    items : ['Appointment', 'Internal', 'Meeting']
}, {...

Pavlo Miklashevych
Sr. Frontend Developer


Post Reply