Show cool things you have done with our products


Post by egorka »

Hi, i added custom column/field to Gantt ( filled it on server side) and it's works fine.
But, i faced with difficulties when i tried to make this field editable (this decimal/number field).
Could somebody provide me an example, how to add custom editable field to Gantt diagramm.

Post by mats »

Please provide a test case showing what you currently have. Make sure you add the fields to your model too.
Ext.define('MyTaskModel', {
            extend   : 'Gnt.model.Task',

            // A field in the dataset that will be added as a CSS class to each rendered task element
            clsField : 'TaskType',

            // Add your own custom fields here
            fields   : [
                { name : 'TaskType', type : 'string' },
                { name : 'Color', type : 'string'}
            ]
        });

Post by egorka »

Thanks for your reply. With you example - ok. I added this fields to model.
"Please provide a test case showing what you currently have" - i need following:
Add additional columns in Gantt (for example "Work Cost", "Work Volume" which is money/decimal), and this fields the user can edit in Gantt:
1. User clicks add new column-> Work Cost, Work Volume
2. Such field appears in left table part in Gantt
3. User clicks on one of this field in table part - it becoming editable. Change Value -> lost focus -> the value saved in db.

1 and 2 item - works fine, problem with editing.
If i understood correctly, such functionality achieved by defining owned column and owned field.
So, i defined field (which is based on Gnt.field.Duration (without percents) ) - Ext.field.MoneyDecimal
and defined column

Ext.define("Gnt.column.WorkCost", {
extend: 'Ext.field.MoneyDecimal',
mixins: ['Gnt.mixin.Localizable'],
alias: "widget.WorkCost",
fieldProperty: 'WorkCostField',
........................

All fine, except one - when I finish editing - the new value disappears from the Gant column, but i checked in js debugger(chrome) that this value was saved in task model and this new value presents in model. Click again to edit - th new value appear again.

Maybe you give me an example of how to implement this functionality in correct and easy way

Post by mats »

You are defining a column, but extending some strange Field type. Your columns must extend Ext.grid.Column, please see docs, and read about the 'editor' config.

https://docs.sencha.com/extjs/4.2.2/#!/a ... umn.Column

Post Reply