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

Removing row from a table with JQuery-> Why page refresh automatically?



my issue is this : I have a simple pageblocktable with some records,when I remove one specific row from the table ... this work well for a moment, then my page is automatically reloaded with the complete pageblocktable and all the rows.


My wish is not delete a record, but to make impossible the view of a row.


This is the code of my controller: 

public with sharing class e2cprovasearchcontroller2 {

	public List<E2C_Email__c> emailsmod;
	public List<E2C_Email__c> getEmailsmod (){

	String id='500T0000004QpWr';

	this.emailsmod=[Select id,subject__c,FromName__c,Read__c,CreatedDate,CcAddress__c from E2C_Email__c where Case__c=:id ORDER BY CreatedDate DESC];

	return this.emailsmod;





This is the code of my page : 

		src="" />
<script src=""/>
<link rel="stylesheet" type="text/css" media="screen" href="" />	
<script type="text/javascript"> 
	//modifico il selettore in modo da non avere conflitti con jquery.
 $j = jQuery.noConflict();
 function hiderows(){
 var prova= $j('#subject'+ 'a0TT0000003BMmGMAW').parent();
 var prova2=$j('#subject'+ 'a0TT0000003BMmGMAW').closest("tr");


	<apex:form >

		<apex:outputpanel >

			<apex:commandbutton value="prova" onclick="hiderows()" />


	<apex:outputpanel layout="block" style="overflow:auto;height:200px">
		<apex:pageBlock id="pb" mode="maindetail">
			<apex:pageBlockTable value="{!Emailsmod}" var="e" columns="5"
				cellspacing="5" onRowClick="show(this)">

				<apex:column headerValue="From" width="22%">
					<span id="from{!}"> {!e.FromName__c} </span>
				<apex:column headerValue="Subject">
					<span id="subject{!}"> {!e.Subject__c} </span>
				<apex:column headerValue="Date" width="7%">
					<span id="date{!}"> <apex:outputText value="{0,date,dd/MM/yy hh:mm}">
						<apex:param value="{!e.CreatedDate}" />
					</apex:outputText> </span>





Thanks to all,




an apex:commandButton will normally submit and refresh the page.  You can either supress this by making your onclick method return false, or just use an HTML <button> if you don't need apex:commandButton functionality.