• kcussen
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies

Good day all,

 

I've got a visualforce page where I need to display lists of a variety of custom objects based on the date. Hence I've set up most of my custom objects as maps similar to the following:

 

Map<Date, List<dailyScheduleWrapper>> dailyScheduleWrappers

 

As long as the Maps are local variables within the controller, I'm not having any issues displaying them. However, if I try to display the maps from a wrapper class inside the controller I start getting the following error: 

 

Visualforce Error

 

Help for this Page


Map key Sun Oct 14 00:00:00 GMT 2012 not found in map

Error is in expression '{!wsw.dailyScheduleWrappers[td]}' in component <apex:repeat> in page weekly_schedule

 

I understand that it's looking for '2012-10-14 00:00:00' as the key, not 'Sun Oct 14 00:00:00 GMT 2012'. I've run through tests to establish the format for the key during creation is 'YYYY-mm-dd hh:mm:ss'. However, the key is the same for the maps local to the controller and they display without any issues - so I'm at a bit of a loss. 

 

 

 

<apex:outputPanel id="wsDisplay">
<apex:repeat value="{!weeklyScheduleWrappers}" var="wsw"> 
<table border="1">
<tr>
<td>
<table border="1">
<tr>
<apex:repeat value="{!testDates}" var="td">
<td>

<!-- This throws the above error -->
{!wsw.dailyScheduleWrappers[td]}
</td> 
</apex:repeat>
</tr>
<tr>
<apex:repeat value="{!testDates}" var="td">
<td>

<!-- This works fine -->
{!allResourceWrappers[td]}
</td>
</apex:repeat>
</tr>
</table>
</apex:repeat>
</apex:outputPanel>

 

and the controller / classes...

 

public with sharing class WeeklyScheduleController {

...

public Map<Date, List<resourceWrapper>> allResourceWrappers { get; set; }

public List<WeeklyScheduleWrapper> weeklyScheduleWrappers { get; set; }

...

 

public with sharing class WeeklyScheduleWrapper {

 

public Map<Date, List<dailyScheduleWrapper>> dailyScheduleWrappers { get; set; }

 

And if someone could let me know how to tag code so it embeds correctly, that would be fantastic. Thanks!