You need to sign in to do that
Don't have an account?
Padmanabhan Kamuni
Need to select one checkbox at a time??
public class Task0 { public List<wrapGroup> acc{get;set;} public List<Group__c> abc{get;set;} public List<Group__c> abc1{get;set;} public string Recid{get;set;} public Task0(){ { acc=new List<wrapGroup>(); abc1 = new List<Group__c>(); List<Group__c> gcc=[SELECT name,id,Course_Name__c,Degree__c,Mobile__c FROM Group__c]; For(Group__c g : gcc ){ acc.add(new wrapGroup(g)); } } system.debug(acc); } public pageReference del(){ // abc=new List<Group__c>(); for(wrapGroup a : acc){ if(a.checkbox1 == true){ abc1.add(a.gname); //string recid = ApexPages.CurrentPage().getParameters().get('a.id'); //string recid; system.debug(' abc1'+abc1); //abc=[select id FROM Group__c WHERE id= :Recid]; //system.debug('List'+abc); } } delete abc1; return null; } public class wrapGroup{ public Group__c gname{get;set;} public boolean checkbox1{get;set;} public wrapGroup(Group__c g){ gname=g; checkbox1=false; } } }
<apex:page controller="Task0" > <apex:form > <script> function enableDisable(cb) { $("input:checkbox[id*=looped]").removeAttr('checked'); $(cb).attr('checked', 'checked'); } </script> <apex:pageBlock > <!--<apex:commandButton value="Delete" action="{!Del}" />--> <apex:pageBlockTable value="{!acc}" var="a" > <apex:column value="{!a.gname.name}"/> <apex:column value="{!a.gname.Mobile__c}"/> <apex:column value="{!a.gname.Course_Name__c}"/> <!-- <apex:column > <apex:outputField value="{!a.gname.Id}"> <apex:param value="{!a.gname.id}" assignTo="{!Recid}" /> </apex:outputField> </apex:column>--> <apex:column title="Select to Delete" > <apex:inputCheckbox id="looped" value="{!a.checkbox1}" onclick="enableDisable(this)" /> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
All Answers
kindly let me know.
Awaiting for your response.
Thanks in advance