function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ashish Kumar YadavAshish Kumar Yadav 

How to display vf page count the number of occurrences of elements

Hi Team,

how to display element count in vf page  if I am trying to display it while click on show product method value of quantity increasing can you help me .
visualforce page i am displaying like that but problem is if i click on pagination first page,last page method is calling so value is increasing so what i need to do.

vf page
======
 <input type="hidden" id='{!a.pricebookentry.Product2.name}q' value="{!elementCount[a.pricebookentry.EN_Code__c]}"/>

Apex class

============
I have added this code in method showproductdata()
 elementCount=new map<string,Integer>();
                    List<String> filterLogicSplittedbySpace = (List<String>)System.JSON.deserialize(barcodeIn, List<String>.class);
                    system.debug('filterLogicSplittedbySpace'+ filterLogicSplittedbySpace.size());
                    for (String str : filterLogicSplittedbySpace){
                        system.debug('str'+str);
                        str =str.trim();
                        elementList.add(str);
                    }
                    system.debug('elementList size'+elementList.size());
                    for(String key : elementList)
                    {
                        system.debug('elementCount.containsKey(key)'+ elementCount.containsKey(key));
                        
                        if(!elementCount.containsKey(key)){
                            elementCount.put(key,0);
                        }
                        
                        currentInt=elementCount.get(key)+1;
                        System.debug('currentInt@@'+currentInt);
                        elementCount.put(key,currentInt);
                        
                    }