Page 1 of 1

Grouping of resource in vertical mode

Posted: Wed Dec 27, 2017 8:52 pm
by vivekBadola
Hi,
I am using Ext Scheduler and I want to group the resources in vertical mode.
As your Ext Scheduler Kitnchen Sink Example has grouping with horizontal mode.
Please help me to achieve this.
Thanks,

Re: Grouping of resource in vertical mode

Posted: Thu Dec 28, 2017 11:04 am
by Maxim Gorkovsky
Hello.
Here is a simple snippet that allows to create nested columns in vertical view, that will group resources by length of the resource name:
Ext.define(null, {
  override: 'Sch.panel.SchedulerGrid',
  createResourceColumns : function (colWidth) {
        var groupsMap = {}, groups = [];

        Ext.Array.each(this.resourceStore.getRange(), function (resource) {
            var col = {
                xclass   : this.resourceColumnClass,
                renderer : this.mainRenderer,
                scope    : this,
                width    : colWidth || 100,
                text     : resource.getName(),
                model    : resource
            };

            var length = resource.getName().length;

            if (groupsMap[length]) {
                groupsMap[length].columns.push(col);
            } else {
                groups.push(groupsMap[length] = {
                    text  : length,
                    columns : [col]
                });
            }
        }, this);

        return groups;
    }
});