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
SFDC AVINASHSFDC AVINASH 

Parameters Issue!

Hi All,
Bellow is my part of VF source code. This is for a row delete button.
<apex:column>
<apex:commandlink  action="{!Deleterow}" immediate="true"><apex:param name="tentryid" value="{!Project.Id}"/><apex:param name="rowNumber" value="{!rowNum}"/><apex:commandbutton value="Delete" /> </apex:commandlink>
</apex:column>

and the corresponding Delete methode is as bellow.
public void Deleterow(){
String rownumber = System.currentPagereference().getParameters().get('rownumber');
Decimal rownumb = Decimal.Valueof(rownumber);
Integer rowno = rownumb.IntValue();
        if (rownumber != ' '){
            system.debug('This is the record' + rownumber);
        tentries.remove(rowno);
        UPSERT tentries;
        }
    }

But its not deleting the records from the row. Any suggestions plz!
SFDC AVINASHSFDC AVINASH
Just to givee a clear picture here is my full VF code.
 
<apex:outputPanel id="entrytable" rendered="{!NOT(ISNULL(entrylist))}">
                <apex:variable value="{!0}" var="rowNum"/>
                <apex:dataTable cellspacing="15" value="{!entrylist}" var="Project">                 
                  <apex:variable var="rowNum" value="{!rowNum + 1}"/> 
                    
                    <td> <apex:column headervalue="QB#">
                <apex:inputfield value="{!Project.QB__c}" style="width:100px;" required="true" rendered="{!(ISNULL(Project.QB__c))}"/>
                <apex:outputfield value="{!Project.QB__c}" style="width:1300px;" /> 
                    </apex:column></td>
				
                 
                 <td>   <apex:column headervalue="Project Desc">
                <apex:inputfield value="{!Project.Description__c}" style="width:100px;" required="true" rendered="{!(ISNULL(Project.Description__c))}"/>
                   <apex:outputfield value="{!Project.Description__c}" style="width:300px;"/>  
                    </apex:column></td>
                   
                
                   <td> <apex:column headervalue="Delivery Date">
                <apex:inputfield value="{!Project.Delivery_Date__c}" style="width:100px;" required="true" rendered="{!(ISNULL(Project.Delivery_Date__c))}" />
                    <apex:outputfield value="{!Project.Delivery_Date__c}" style="width:300px;"/>
                    </apex:column> </td>
                
                <td>
                <apex:column>
                    <apex:commandlink  action="{!Deleterow}" immediate="true"><apex:param name="tentryid" value="{!Project.Id}"/><apex:param name="rowNumber" value="{!rowNum}"/><apex:commandbutton value="Delete" />    </apex:commandlink>
                </apex:column>
                </td>  
               </apex:dataTable>
                    </apex:outputPanel>
            
           
            <apex:commandButton value="Create New" action="{!CreateNew}"/>
          <apex:commandButton value="Save" action="{!Save}"/>

 
James LoghryJames Loghry
Looks like your checking for the incorrect parameter.  Map keys are case sensitive, so rowNumber is different than rownumber.  That being said, here's how I would approach it.  Note, that the rerender="idofpageblock" should point to the id of a parent element, which is also case sensitive.  
 
<apex:column>
    <apex:commandbutton value="Delete" rerender="idofpageblock" action="{!deleteRow}">
        <apex:param name="rowNumber" value="{!rowNum}" assignTo="{!rowNumber}"/>
    </apex:commandButton>
</apex:column>

(Apex class)
//Create a public member variable for the assignTo attribute...
public Decimal rowNum {get; set;}

public PageReference deleteRow(){
    tentries.remove(rowNum);
   //Other stuff 
   return null;
}

 
James LoghryJames Loghry
For more on the command button and parameters, see here: http://blog.jeffdouglas.com/2010/03/04/passing-parameters-with-a-commandbutton/