I create a map in the apex controller to store whether or not a QuoteLineItem has related records:
qliHasQimus = new Map<Id, Boolean>();
for (QuoteLineItem qli : qlis) {
if (qli.QuoteItemMaintenanceUplifts__r.IsEmpty()) {
qliHasQimus.put(qli.Id, false);
} else {
qliHasQimus.put(qli.Id, true);
}
}
When I use this map inside of an apex column I get no errors:
<apex:column breakBefore="true" colspan="{!$ObjectType.QuoteLineItem.FieldSets.Quote_Cloner_Quote_Line_Detail.size + 1}"
styleClass="nestedTableCell">
{!qliHasQimus[qli.Id]}
</apex:column>
When I try to use it in the rendered attribute for the same column, I get the following error:
Map key null not found in map Error is in expression '{!qliHasQimus[qli.Id]}' in component in page clonequote
Example:
<apex:column breakBefore="true" colspan="{!$ObjectType.QuoteLineItem.FieldSets.Quote_Cloner_Quote_Line_Detail.size + 1}"
styleClass="nestedTableCell" rendered="{!qliHasQimus[qli.Id]}"/>
I've attempted to resolve it using an apex:variable tag:
<apex:pageBlockTable value="{!qlis}" var="qli">
<apex:variable value="{!qliHasQimus[qli.Id]}" var="hasQimus"/>
And this doesn't throw any errors; however, none of the columns are rendered even if they have related items.
Right now I'm using it to render sub components of the column but that create's an an empty column in the table. I need to be able to hide this column if it is empty (it's a nested table).