Discuss anything related to web development but no technical support questions


Post by naveen »

I have %Done column
xtype       : "percentdonecolumn",
                      width       : 100


and i have Done column
xtype : 'checkcolumn',
                      header: 'Done',
                      dataIndex: 'TaskStatus',
How to populate %Done value to 100 when click on Done checkbox and similarly when the %Done value is 100,Done checkbox should be clicked automatically

Post by Terence »

Listen to the checkchange event and set percentDone to 100% in the record that comes with the event
https://docs.sencha.com/extjs/6.5.0/clas ... heckchange

In case percentdone is set 100% you could override https://bryntum.com/products/gantt-for-extjs/docs/5.x ... ercentDone function and update the TaskStatus accordingly.

Post by naveen »


Post by Terence »

Just like you would normally override a function.
Ext.define('Gnt.examples.advanced.model.Task', {
    extend  : 'Gnt.model.Task',

    setPercentDone : function (value) {
       this.callParent(arguments);
       this.set('YourField', value);
     }
});

Post by naveen »

Any examples???

Post by naveen »

One more thing,
the above override function is to check the checkbox right?
No it is to catch changes on the percentdone field
Little update
Ext.define('Gnt.examples.advanced.model.Task', {
    extend  : 'Gnt.model.Task',

    setPercentDone : function (value) {
       this.callParent(arguments);
       this.set('DoneField',value === 100);     
});
The checkbox will update upon datachange.

Post by Terence »

Any examples???
I gave you an example based on the TaskModel of the advanced example.

https://docs.sencha.com/extjs/6.5.0/clas ... heckchange

Is a listener you can set on your column. It's just common extjs. Please also consult extjs docs how to override functions and attach listeners.

Post by naveen »

I have written like this
%Done column
{
           xtype       : "percentdonecolumn",
           width       : 100
          },
and Done column
{   
 xtype : 'checkcolumn',
 header: 'Done',
 dataIndex: 'TaskStatus',
 width: 75,
 	listeners : {
	                checkchange :  function(item, rowIndex, checked, eOpts){                                
	                        var currTask = ganttPanelObject.taskStore.data.items[rowIndex];
	                        if(checked){                                   
	                            currTask.set('PercentDone', 100);
	                        }else{
	                            currTask.set('PercentDone', 0);
	                        }

	                },
                }
                      
},

Post by Terence »

And does it work?

Post by naveen »

Able to set %Done as 100% but for vice versa i am getting some errors(attributes undefined)

Post Reply