You need to sign in to do that
Don't have an account?

Delete child records from Related List without refreshing the whole page
I have displayed Account records in pageblock table , and account names are displayed in command link when ever i click on command link the detail page of that particular account will displayed below the pageblock table , that detail page contains related list, from that related list i want to delete child records without refreshing the whole page that means here i want partial page refresh. Can any body help me..?
<apex:pageblocktable id="pageblkTable">
your code
<apex:commandLink action="{!delete}" value="Delete" rerender = "pageblkTable"/>
</apex:pageblocktable>
In controller
public void delete(){
//Your code;
}
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
This is my vf page
<apex:page controller="relatedlist1cls" showHeader="false">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!lstacc}" var="a">
<apex:column headerValue="Click Me">
<apex:commandLink value="{!a.name}" reRender="detail">
<apex:param value="{!a.id}" assignTo="{!aid}" name="name1"/>
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:outputPanel id="detail">
<apex:detail subject="{!aid}"/>
</apex:outputPanel>
</apex:form>
</apex:page>
And this is my controller
public with sharing class relatedlist1cls {
public id aid{get;set;}
public list<Account> lstacc{get;set;}
public relatedlist1cls(){
lstacc=[select id,name from Account];
}
}
Please do here......
<apex:page controller="relatedlist1cls" showHeader="false">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!lstacc}" var="a" id="pageBlkTable">
<apex:column headerValue="Click Me">
<apex:commandLink value="{!a.name}" reRender="detail,pageBlkTable">
<apex:param value="{!a.id}" assignTo="{!aid}" name="name1"/>
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:outputPanel id="detail">
<apex:detail subject="{!aid}"/>
</apex:outputPanel>
</apex:form>
</apex:page>
From where are you calling the method for deleting?
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
here if you click on Account name you have a detail page of that particular account detail page that account contains child(contact) records, here i have to delete those child(contact) records.
Yes, that detail page and related list code is your visualforce. right? Then in that visualforce page you can use that rerender as I mentioned above for the partial refresh to rerender only that related list pageblocktable for the child records of accounts.
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
Yes Avidev,
If it is a standard layout, nothing to do with it. :)
Thanks
so finally can we achieve this partial page refresh or not.. ? here
If it is standard layout it can't be done. If it is custom VF page then you can proceed with the above posts of rerendering.
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
Ok here is a workaround for you.
Create a VF page with just
Now modify the original code to display the above page in iframe
This will refresh the iframe only not the whole page.
Hope this helps
thnx for giving u r suggestions mr.souvik . Here i am using custom VF page here where do you use rerendering pla do copy and page my code in your orgination you will understand clearly.. and the do answer.
Thnx for giving reply here i am using Custom VF page where do you use rerendering please do copy paste my code in your orgination you will understandart clearly.
sorry Avidev here not comming that means <apex:iframe src="/apex/detail1?Id={!aid}"/> not working it shows another page here.
And have you selected any records using your click me link ?
Tried the same and is working for me
If it was working to you please send me code plzzzzzzzz
There was lil mistake in the iframe code
Should be
<apex:iframe src="/apex/YOURNEWVFPAGENAME?id={!aid}"/>
in "id", "i" is in small
Thanx Mr.Avidev it works successfully but the problem is here 2 more same pages are opened in current page and also i got same pages in current page every time i click on account name.. how can i reduce this...? plz do help
helloooo
Thanx Mr.Avidev it works successfully but the problem is here 2 more same pages are opened in current page and also i got same pages in current page every time i click on account name.. how can i reduce this...? plz do help
Mass delete component example here see if it helps you out,
http://cloudforce4u.blogspot.in/2013/06/visualforce-page-component-for-mass.html
Can you please share a screenshot ?
kkk
here asking only plain text how can i share screenshots..?
hello Yoganand Gadek this is my require ment plz go through this requirement and do reply
I have displayed Account records in pageblock table , and account names are displayed in command link when ever i click on command link the detail page of that particular account will displayed below the pageblock table , that detail page contains related list, from that related list i want to delete child records without refreshing the whole page that means here i want partial page refresh. Can any body help me..?
kk
send u r mail id..
Again am saying make sure your other VF page that is displayed in iframe has sidebar="false" and showHeader="false" this will hide the standard headers and sidebar.!
yaa i have done that bt i have got 2 more same pages in current page, how can u get proper result tell me once..?
kk this is my recent code
Page:
<apex:page controller="relatedlist1cls" showHeader="false">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!lstacc}" var="a" id="pbt">
<apex:column headerValue="Click Me">
<apex:commandLink value="{!a.name}" reRender="detail,pbt">
<apex:param value="{!a.id}" assignTo="{!aid}" name="name1"/>
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:outputPanel id="detail">
<!-- YOURVFPAGENAME is the name of the page that is created earlier to accomodate the apex:detail -->
<apex:detail subject="{!aid}"/>
<apex:iframe src="/apex/relatedlist1?id={!aid}"/>
</apex:outputPanel>
</apex:form>
</apex:page>
this is the controller:
public with sharing class relatedlist1cls {
public id aid{get;set;}
public list<Account> lstacc{get;set;}
public relatedlist1cls(){
lstacc=[select id,name from Account];
}
}
please check it out once
Ohh god!!!
WHy the hell you have kept "<apex:detail subject="{!aid}"/>" in the page ?
I guess we moved it to the other page!
without using this <apex:detail subject="{!aid}"/> how can u get related list..? form that code(u r sending code) how can u get related list tell me..? show me once...?
Please get your fundamentals clear about iframe!
I already gave you solution and please do Read it carefully.
Create a VF page with just [this page will be displayed in the iframe to show the detail]
VF page Name : YOURNEWVFPAGENAME
Now modify the original code to display the above page in iframe
VF Page Name : This is our original VF page
This will refresh the iframe only not the whole page.
Hope this helps
if i will do that i got an error like "Id value is not valid for the Account standard controller"
ahhhh man!
Select a record from your link and see what happens!
IF it works you know what needs to be done ;)
else I fear that you have to hire a develoepr!
the links and table are not appear only that error will appear....
ahhhh... this one is final I guess you are aware why this error is coming!
because at page load aid is NULL.
use rendered attributee to handle the situation
Thanx alot Mr.Avidev But that page was reidtect to account detail page...