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
kitsunebravekitsunebrave 

Retrieving a primary table and displaying to secondary table

Hi everyone,

Regarding Visualforce, force.com and Javascript development. Basically, I have two table primary and secondary. I want to retrieve the Product Info from a primary table and show to a secondary table. The Wrapper logic is completed, however, I need to display multiple selection based on one or more selected Products. Here is the Partial visualforce page, Javascript resource and the apex method.

Therefore, I need to refresh/onchange the checkbox based on specific event "selected" "removed" "multiselection" filter values.

I am waiting from anyone to answer this question regardless the post question https://developer.salesforce.com/forums/?id=906F00000009683IAA by @Surjendu, @kmccoll and @TehNrd. How can complete and avoid this issue basically to have a Specific Salesforce Product based on the selection of the Product Checkbox.

Please, follwing is the related code snippets regarding my issue:

Visualforce Page:
 
<table width="100%" border="2">
  <tr>
      <td width="75" valign="top" ><b>Search by Product</b>
           <div style="overflow:auto; height:250px;">
              <apex:pageBlockTable title="Search by Product Table" value={!ProductFilters}" var="productrecord" id="productsList">
                  <apex:column style="width:25px" >
                     <apex:inputCheckbox id="productLine1" onclick="showContent(this)" value="{!productrecord.selectedProduct}" />
                   </apex:column>
                   <apex:column style="width:50px" onclick="uncheckOther('productLine1')" value="{!productrecord.filter.Entitlement}" >
                   </apex:column>
               </apex:pageBlockTable>
            </div>
         </td>
    </tr>
</table>
<table width="100%" border="2" id="splitTable">
   <tr>
       <td width="100%" valign="top">
          <div id="content" style="overflow:auto; height:400px; display: block">
               <apex:pageBlockTable title="Results of the selection of Version/Entitlement Products on the initial page" value="{!displayItems}" var="record" id="displayListing">
                   <apex:column style="width:25px" >
                       <apex:facet name="header">
                         <apex:inputCheckbox id="displayChkBx" onclick="checkAll('productLine1','{!$Component.displayListing}', 'displayItemsLine1')" />
                       </apex:facet>
                         <apex:inputCheckbox value="{!record.selected}" id="selectLine1" />
                    </apex:column>
                    <apex:column id="colVersion" style="width:60px" value="{!record.dispItem.ProductVersion}" headerValue="Release Version">
                    </apex:column>
               </apex:pageBlockTable>
             </div>
          </td>
     </tr>
</table>
Apex Method:
 
public class productfilterWrapper{
        public V1_NoteSelectionItems filter {get; set;}
        public Boolean selectedProduct {get; set;}
        public productfilterWrapper(V1_NoteSelectionItems a)
        {
            filter = a;
            selectedProduct = false;
        }
    }

public void filterBySelections(){
		selectionItemsListing.SetSelectedItemsList(collectSelectedProducts());			
	}

public Set<String> collectSelectedProducts() {
    	Set<String> allProducts = new Set<String>();
        this.selectedProductFilters.clear();
        for(productFilterWrapper productWrapper : this.productFiltersList)
        {
            if(productWrapper.selectedProduct == true)
            {
	        	System.debug('Product selected: ' + productWrapper.filter.Entitlement);
        		allProducts.add(productWrapper.filter.Entitlement);
            	this.selectedProductFilters.add(productWrapper.filter);
            }
        }
        return allProducts;
    }
JS:
 
function showContent(chkboxCtrl){
	try{
		Product = document.getElementById('{!$Component.frm.secondTable.bottomTableId.splitTable.content.displayListing.colProduct}');
  		Version = document.getElementById('{!$Component.frm.secondTable.bottomTableId.splitTable.content.displayListing.colVersion}');
  		Component = document.getElementById('{!$Component.frm.secondTable.bottomTableId.splitTable.content.displayListing.colComponent}');
  		Backlog = document.getElementById('{!$Component.frm.secondTable.bottomTableId.splitTable.content.displayListing.colBacklog}');
		if (chkboxCtrl.checked){
			if(Product != null)
				Product.style.display = 'block';
			else
				Product.style.display = 'none';
			if(Version != null)
				Version.style.display = 'block';
			else
				Version.style.display = 'none';
			if(Component != null)
				Component.style.display = 'block';
			else
				Component.style.display = 'none';
			if(Backlog != null)
				Backlog.style.display = 'block';
			else
				Backlog.style.display = 'none';
		}			
		else
			document.getElementById('{!$Component.frm.secondTable.bottomTableId.splitTable.content.displayListing}').style.display = 'none';
	}
	catch(e){
		alert(e);
	}	
}
/*uncheck content and checkbox*/
var selectedChkbox;

function uncheckOther(chkboxCtrl){
	if(chkboxCtrl.checked){
		if((chkboxCtrl != selectedChkbox) && (selectedChkbox != null)){
			selectedChkbox = false;
		}
		selectedChkbox = chkboxCtrl;
	}
}

Please, any solution, partial post or any things related to this, let me know.

Thanks in advance.

kitsunebrave