I'm trying to reset an Integer value to null, but it is converted to 0.
<apex:actionFunction action="{!doSomething}" name="doSomething" rerender="nothing">
<apex:param name="indexValue" assignTo="{!index}" value="{!NULL}" />
</apex:actionFunction>
public class MyController{
public Integer index { get; set; }
public void doSomething() {
System.debug(index);
}
}
Is there way to set it to null?
public static Integer index;
to see if that makes a difference for you. Declaring it as a static variable may allow you to assign it as null. The problem is that most methods and classes won't allow you to pass a null value for a variable, but if you're not passing it into your method and it's defined as static, it would persist and you could change it to null without passing it back into your class. Avoid putting it in a method and your problem will disappear. Ditto for theget, set