This is a migrated thread and some comments may be shown as answers.

Filter Resources by Visibility

1 Answer 66 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 23 Mar 2011, 06:59 PM

Hi

I want to use the grouping function of radScheduler to only group visible resources.
But it does not work, it always shows all resources.
What am I doing wrong?

*** sample code loading Resources

            Resource tempResource = null;

            recResourceGroup[] resourceGroups = plannerSettings.recResourceGroup;
            foreach (recResourceGroup resourceGroup in resourceGroups)
            {
                tempResource = new Resource("G-"+resourceGroup.No,resourceGroup.Name);
                tempResource.Visible = false;
                tempResource.Color = Color.Orange;
                plannerSchedule.Resources.Add(tempResource);

                recResource[] resources = resourceGroup.recResource;
                foreach (recResource resource in resources)
                {
                    string sKey = resource.IsRentalItem.ToString() == "1" ? "M" : "R";
                    sKey += resource.VirtualResource.ToString() == "1" ? "V-" : "-";
                    tempResource = new Resource(sKey+resource.No,resource.Name);
                    tempResource.Visible = false;
                    tempResource.Color = Color.Green;
                    plannerSchedule.Resources.Add(tempResource);
                }
            }

*** sample code loading Appointment-Resources

foreach (recResourceAssigned planningAssignedResource in planningAssignedResources)
{
    string sKey = null;
    switch (planningAssignedResource.Type.ToString())
    {
        case "0":  //resource
            {
                sKey = "R-" + planningAssignedResource.No.ToString();
            }
            break;
        case "1":  //resourceGroup
            {
                sKey = "G-" + planningAssignedResource.No.ToString();
            }
            break;
        case "2":  //workPlace
            {
                sKey = "W-" + planningAssignedResource.No.ToString();
            }
            break;
        default:
            {
                //error not supported
            }
            break;
    };
    schedulerApp.ResourceIds.Add(plannerSchedule.Resources.GetById(sKey).Id);
}

*** Sample code switching visibility of Resources

  foreach (Resource resource in radScheduler1.Resources)
  {
      string tempKey = resource.Id.KeyValue.ToString();
      switch(groupby)
      {
          case "resource":
              resource.Visible = tempKey.Contains("R-") ? true : false;
              break;
          case "resourceGroup":
              resource.Visible = tempKey.Contains("G-") ? true : false;
              break;
          case "workplace":
              resource.Visible = tempKey.Contains("W-") ?  true : false;
              break;
          case "order":
              resource.Visible = tempKey.Contains("J-") ? true : false;
              break;
         default:
              resource.Visible = false;
              break;
       }
...
  

 

 

radScheduler1.RepaintElements();

 

 

 


any ideas?
Daniel

1 Answer, 1 is accepted

Sort by
0
Dobry Zranchev
Telerik team
answered on 28 Mar 2011, 06:12 PM
Hello Daniel,

Thank you for writing.

RadScheduler does not filter the resources by their visibility. If you want to hide some of the resources, you should to remove them from the Resources collection of RadScheduler. When you want to use them again, you should just add them to the same collection.

In case that you have other related questions, do not hesitate to write back.

Regards,
Dobry Zranchev
the Telerik team
Tags
Scheduler and Reminder
Asked by
Daniel
Top achievements
Rank 1
Answers by
Dobry Zranchev
Telerik team
Share this question
or