In my apex code I am adding some value into map. And I am trying to loop through the map on VF page using apex:repeat but I am getting an error that
This map cannot be used in an iteration because the keys cannot be sorted
Is anyone here can tell me what might be the issue. The versions of both the Apex code and VF page is same 31. my code is bellow
VF page :
<apex:repeat value="{!sObjectFieldMap}" var="sobj">
</apex:repeat>
controller :
public with sharing class survey_ResultV2Ctrl{
public Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
public Map<Schema.SObjectType, List<Schema.SObjectField>> sObjectFieldMap {get; set;}
public List<Schema.SObjectField> sObjectFieldLst = new List<Schema.SObjectField>();
public List<wrapperClass> wcls {get; set;}
public set<Schema.SObjectType> objNameSet = new set<Schema.SObjectType>();
public survey_ResultV2Ctrl(){
sObjectFieldMap = new Map<Schema.SObjectType, List<Schema.SObjectField>>();
wcls = new List<wrapperClass>();
survey_ResultDisplay();
}
public void survey_ResultDisplay(){
for(Filter_Field_Set__c ffs : [SELECT Name, Field_Set_Category__c, Object_Fields__c, Object_Fields_Name__c FROM Filter_Field_Set__c Where Field_Set_Category__c = 'a0F9000000R5Fau']){
system.debug('All the result from Filter Field Set object ' + ffs.Name);
system.debug('Schema Map contains Key as object name ' + schemaMap.containsKey(ffs.Name));
Map <String, Schema.SObjectField> fieldMap = schemaMap.get(ffs.Name).getDescribe().fields.getMap();
if(schemaMap.containsKey(ffs.Name)){
system.debug('Schema object Values ' + schemaMap.get(ffs.Name));
system.debug('All the fields related to Schema object ' + fieldMap.get(ffs.Object_Fields_Name__c));
if(sObjectFieldMap.containskey(schemaMap.get(ffs.Name))){
sObjectFieldLst.add(fieldMap.get(ffs.Object_Fields_Name__c));
sObjectFieldMap.put(schemaMap.get(ffs.Name), sObjectFieldLst.clone());
//objNameSet.add(schemaMap.get(ffs.Name));
//wcls.add(new wrapperClass(schemaMap.get(ffs.Name), sObjectFieldLst));
sObjectFieldLst.clear();
}
else{
sObjectFieldLst.add(fieldMap.get(ffs.Object_Fields_Name__c));
sObjectFieldMap.put(schemaMap.get(ffs.Name), sObjectFieldLst.clone());
//wcls.add(new wrapperClass(schemaMap.get(ffs.Name), sObjectFieldLst));
//objNameSet.add(schemaMap.get(ffs.Name));
}
}
}
system.debug('The wapper class after loop ' + wcls);
system.debug('The Map after loop ' + sObjectFieldMap);
}
public with sharing class wrapperClass{
public list<Schema.SObjectField> fieldname {get; set;}
public Schema.SObjectType objectName {get; set;}
public wrapperClass(Schema.SObjectType objectName, list<Schema.SObjectField> fieldname){
objectName = objectName;
fieldname = fieldname;
}
}
}
Please help me if anyone have any idea on this issue.