How to show no of hours instead of no of days at Duration ?

Discuss anything related to Ext JS development.

How to show no of hours instead of no of days at Duration ?

Postby gowthamguptha » Tue Apr 24, 2012 12:44 pm

hi ,
I am using trail version of your product Ext Gantt . i want to show the "no of hours" on duration column instead of "no of days".

Can you suggest how to show no of hours on duration coloum on page load itself?
gowthamguptha
 
Posts: 32
Joined: Tue Apr 24, 2012 10:42 am

Re: How to show no of hours instead of no of days at Duratio

Postby jakub » Tue Apr 24, 2012 1:31 pm

Not sure what do you mean by 'page load itself' but you can extend our Duration column in this way :

Code: Select all
Ext.define("MyColumnDuration", {
    extend      : "Gnt.column.Duration",
    timeUnit    : 'd',

    renderer    : function (value, meta, task) {
        value = task.getDuration(this.timeUnit)
        if (!Ext.isNumber(value)) return '';
       
        value   = parseFloat(Ext.Number.toFixed(value, this.decimalPrecision));

        return value + ' ' + Sch.util.Date.getReadableNameOfUnit(this.timeUnit, value > 1);
    }
});


and then when defining columns :

Code: Select all
                Ext.create('MyColumnDuration', {             
                    timeUnit : 'h'
                })


We should probably think about adding display unit as a config option, so thanks for showing this to us.
We offer training in both Ext JS and our products, read more here.
Read the API documentation
User avatar
jakub
 
Posts: 1308
Joined: Wed Jan 25, 2012 7:26 pm
Location: Warsaw, Poland


Return to Open discussion

Who is online

Users browsing this forum: No registered users and 1 guest