I want to integrate jquery to show/hide table rows dependent on a parameter:
The jQuery looks like this:
<apex:includeScript value="{!URLFOR($Resource.input_js, 'input_js/jquery-3.1.0.min.js')}" />
<script>
$j = jQuery.noConflict();
$j(document).ready(function() {
var addcount = '{!addcount}';
var contact = $j('[id$=table]').get();
for (i = 0; i < 20; i++) {
if (i < addcount) {
console.log(contact[i]);
$j(contact[i]).show();
} else {
$j(contact[i]).hide();
}
}
}
</script>
And the table rows like this:
<div id="table">
<apex:repeat value="{!listTest}" var="item">
<div id="contact">
<div class="divTable">
<div class="divRow">
<div class="cellOne">
<label>Test</label>
</div>
<div class="cellTwo">
<apex:inputText value="{!item.Test}"></apex:inputText>
</div>
</div>
<div class="divRow">
<div class="cellOne">
<label>Test2</label>
</div>
<div class="cellTwo">
<apex:inputText value="{!item.Test2}"></apex:inputText>
</div>
</div>
</div>
</div>
</apex:repeat>
</div>
The parameter "addcount" is defined in the table as:
public Integer addCount {get; set;}
and further defined in a method. The display "{!addcount}" on Visualforce works correctly.
Also, the jQuery seems to be called correctly. So why is it not working? Thanks!
<apex:pageBlockTable>here? If you wrap the entire row in an<apex:outputBlock>, you could set therenderedattribute as desired (if displaying your rows is controlled by something in the controller/extension).rerenderis different fromrendered