jquery - Dynamically Removing Record from pageBlockSection in Visualforce -
i've built visualforce page below jquery snippet dynamically adds pageblocksection when button "add dev" clicked.
<apex:commandbutton value="add dev" action="{!newdev}" rerender="devs" oncomplete="scroll();"/> <script type="text/javascript"> var j$ = jquery.noconflict(); function scroll(){ var docheight = j$(document).height(); var winheight = j$(window).height(); j$('html,body').animate({scrolltop: docheight - winheight}, 1000); } </script>
below method adding newdev. want add button within pageblocksection executes removedev method that, when clicked, removes pageblocksection it's in both view , list dev.
public void newdev(){ devs.add(new development__c(change_set__c = changeset.id)); }
i've tried deleting dev through dml operation, causes error. i've tried removing dev .remove list method doesn't seem right approach. i'm stuck. ideas?
you can't deleting dev through dml operation because not insert him before. change function newdev
public void newdev(){ development__c dev = new development__c(change_set__c = changeset.id); insert dev; devs.add(dev); }
Comments
Post a Comment