Discuss anything related to web development but no technical support questions


Post by Jay »

Hi

I worked around filtering the resource assignments. The requirement is i could able to select resources in the bottom histogram window so then the selected resources assigned tasks should be filtered in the top grid.
I have done the following steps,

step 1 - created selection Model and attached to Histogram grid

var sm = Ext.create('Ext.selection.CheckboxModel');

Ext.define('Gnt.examples.advanced.view.ResourceHistogram', {
extend : 'Gnt.panel.ResourceHistogram',
alias : 'widget.resourcehistogram',
................................
selModel: sm,
listeners : {
itemclick: function (grid, record, item, index, e) {
var selectedResources = grid.getSelectionModel().getSelection();

for (i = 0; i <= selectedResources.length - 1; i++) {
//Run Through all the selected resources

}
}
},

now if i select the selection check boxes, its firing the item click listener, so that i can able to get the selected resources Id.

My question is, Now I need to filter the task store based on these selected resource assignments.
Could you help me to complete this step?
HistogramFiltering.JPG
HistogramFiltering.JPG (122.98 KiB) Viewed 2921 times

Post by Maxim Gorkovsky »

Hello.
You can see how we filter task store in advanced example. Take a look at this method

Post by Jay »

I already checked in Sch.data.mixin.FilterableTreeStore

Sch.data.mixin.FilterableTreeStore is used to filter one task, although Is it supports to filter multiple task on the same time ?

How i can get the tasks by resourceId ? I could able to access the taskStore and resourceStore inside the method. I need to to how i can filter assigned tasks
itemclick: function (grid, record, item, index, e) {
            var selectedResources = grid.getSelectionModel().getSelection();

            for (i = 0; i <= selectedResources.length - 1; i++) {
                //Run Through all the selected resources
                // posible to call taskStore and resourceStroe
                //How can i get all the task assigned for this resource?
                //How can i filter multiple task below?
                this.taskStore.filterTreeBy(function (node) {
                   ////----------
                });

            }
        }

Post by Maxim Gorkovsky »

Our filterTreeBy works just like ext filtering: if function return true - node is included on result, otherwise it's filtered out.

To get tasks assigned for specific resource, you can use getTasksForResource method on store, or getTasks on resource instance.

Post Reply