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
gene.koopmangene.koopman 

Checkboxes Limiting Dynamic DataTable Rendering

This is an odd one, hopefully one of you superstars can help a brother out.

 

I have a 'picker' page, where users chose a product and add it to a list. I have an action function processing the addition, and it's working fine. On completion of the action function, I rerender the dataTable with the added products. Here's the code for the dataTable:

 

        <apex:dataTable value="{!UserProducts}" var="userProd" id="tblUserProducts">
            <apex:column>
                <apex:facet name="header"><input id="chkSelectAllUserProducts" type="checkbox"/></apex:facet>
                <apex:inputcheckbox value="{!userProd.ID}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header"><b>Product</b></apex:facet>
                {!userProd.Name}
            </apex:column>         
            <apex:column >
                <apex:facet name="header"><b>Platform</b></apex:facet>
                {!userProd.Platform__c}
            </apex:column>
            <apex:column >
                <apex:facet name="header"><b>Media Group</b></apex:facet>
                {!userProd.Media_Group_Code__c}
            </apex:column>
        </apex:dataTable>

 Here's the problem: After the first insert, no other values can be inserted. I execute the code, and nothing happens. In fact, it breaks some of the other JS on my page. But, if I remove the <apex:inputCheckbox .../> from the first column, BANG!! It all works again. As you might guess, I'm providing the ability to remove multiple items at once, based on whether the items are checked or not. Any idea why the checkbox would cause this kind of error?

 

Thanks,
Gene

 

Best Answer chosen by Admin (Salesforce Developers) 
Pratibh PrakashPratibh Prakash

Hello,

 

First of all why are you binding the inputCheckBox to a Id field, checkbox should be linked to Boolean field i guess.

So as soon as you hit controller first time it works but afterwards it wont work as the inputcheckBox is bound to inappropriate field.

All Answers

Pratibh PrakashPratibh Prakash

Hello,

 

First of all why are you binding the inputCheckBox to a Id field, checkbox should be linked to Boolean field i guess.

So as soon as you hit controller first time it works but afterwards it wont work as the inputcheckBox is bound to inappropriate field.

This was selected as the best answer
gene.koopmangene.koopman

That did it. I meant to use the 'Title' property to set the ID of the record. Stupid. 

Thanks,
Gene