Page:
<apex:page controller="DTTestPageController" tabStyle="Lead" lightningStylesheets="true">
<apex:messages/>
<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<apex:form id="form">
<apex:pageBlock mode="inlineEdit" id="pageblock1">
<div id="header" class="headerborder">
<p id="title">DT Worksheet</p>
<p id="select">
<apex:selectList size="1" id="filter" value="{!pickValue}">
<apex:actionSupport event="onchange" action="{!GetMedicals}" rerender="table1"/>
<apex:selectOption itemLabel="All" itemValue="All" ></apex:selectOption>
<apex:selectOption itemLabel="Needs Review" itemValue="Review" ></apex:selectOption>
<apex:selectOption itemLabel="Pay" itemValue="Pay"></apex:selectOption>
<apex:selectOption itemLabel="Don't Pay" itemValue="Dont Pay"></apex:selectOption>
</apex:selectList>
<apex:commandButton id="alert" value="Alert" rerender=""/>
</p>
</div>
<apex:pageBlockButtons location="bottom">
<apex:commandButton id="saveButton" value="Save" rerender="" action="{!saveme}"/>
<apex:commandButton id="cancelButton" value="Cancel" rerender=""/>
</apex:pageBlockButtons>
<div class="tableborder" id="border">
<apex:pageBlockTable value="{!lstMedicals}" var="med" id="table1">
<apex:column headerValue="Medical Bill Number" headerClass="headerStyle">
<apex:actionRegion >
<apex:outputLink value="/{!med.Id}" styleClass="link">
{!med.Name}
</apex:outputLink>
</apex:actionRegion>
</apex:column>
<apex:column headerValue="Provider" headerClass="headerStyle">
<apex:actionRegion >
<apex:outputField value="{!med.Provider_Name__c}">
</apex:outputField>
</apex:actionRegion>
</apex:column>
<apex:column headerValue="Pay?" headerClass="headerStyle" id="column1">
<apex:facet name="header">
<!-- <apex:commandLink action="{! sortByFirstName }"
reRender="contacts_list">Pay
</apex:commandLink> -->
</apex:facet>
<apex:actionRegion id="actionRegion1">
<apex:outputField value="{!med.Disburse__c}" id="pay">
<apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton,cancelButton"/>
</apex:outputField>
</apex:actionRegion>
</apex:column>
<apex:column headerValue="Notes" headerClass="headerStyle">
<apex:actionRegion >
<apex:outputField value="{!med.Disbursement_Note__c}">
<apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton,cancelButton" id="note"/>
</apex:outputField>
</apex:actionRegion>
</apex:column>
</apex:pageBlockTable>
</div>
</apex:pageBlock>
</apex:form>
</html>
</apex:page>
Controller:
public class DTTestPageController {
private String sortOrder = 'LastName';
public string pickValue{get; set;}
public litify_pm__Matter__c matterId{get; set;}
public Id recordTypeId = Schema.SObjectType.Medical_Bill__c.getRecordTypeInfosByName().get('Medical').getRecordTypeId();
public list<Medical_Bill__c> lstMedicals{get; set;}
public void GetMedicals() {
System.debug(pickValue);
if (pickValue == 'All') {
lstMedicals = [Select Id, Name, Provider_Name__c, Disburse__c, Disbursement_Note__c from Medical_Bill__c WHERE Matter__c =: matterId.Id AND RecordTypeId =: recordTypeId];
}
else if (pickValue == 'Review') {
lstMedicals = [Select Id, Name, Provider_Name__c, Disburse__c, Disbursement_Note__c From Medical_Bill__c WHERE Matter__c =: matterId.Id AND RecordTypeId =: recordTypeId AND Disburse__c = null];
}
else if (pickValue == 'Pay') {
lstMedicals = [Select Id, Name, Provider_Name__c, Disburse__c, Disbursement_Note__c From Medical_Bill__c WHERE Matter__c =: matterId.Id AND RecordTypeId =: recordTypeId AND Disburse__c = 'Yes'];
}
else if (pickValue == 'Dont Pay') {
lstMedicals = [Select Id, Name, Provider_Name__c, Disburse__c, Disbursement_Note__c From Medical_Bill__c WHERE Matter__c =: matterId.Id AND RecordTypeId =: recordTypeId AND Disburse__c = 'No'];
}
else {
lstMedicals = [Select Id, Name, Provider_Name__c, Disburse__c, Disbursement_Note__c from Medical_Bill__c WHERE Matter__c =: matterId.Id AND RecordTypeId =: recordTypeId];
}
}
public pagereference saveme()
{
try
{
System.debug(lstMedicals);
update lstMedicals;
}
catch(DmlException ex)
{
ApexPages.addMessages(ex);
}
return NULL;
}
/* public void sortByFirstName() {
this.sortOrder = 'LastName';
} */
}
Jacob , You need to add the constructor (this will initialize your method and fill your data) in your class , that will do the magic :)
public DTTestPageController(){
pickValue = 'All';
GetMedicals();
}
Final Code would be something like this below
Hope this helps!public class DTTestPageController {
private String sortOrder = 'LastName';
public string pickValue{get; set;}
public litify_pm__Matter__c matterId{get; set;}
public Id recordTypeId = Schema.SObjectType.Medical_Bill__c.getRecordTypeInfosByName().get('Medical').getRecordTypeId();
public list<Medical_Bill__c> lstMedicals{get; set;}
public DTTestPageController(){
pickValue = 'All';
GetMedicals();
}
public void GetMedicals() {
System.debug(pickValue);
if (pickValue == 'All') {
lstMedicals = [Select Id, Name, Provider_Name__c, Disburse__c, Disbursement_Note__c from Medical_Bill__c WHERE Matter__c =: matterId.Id AND RecordTypeId =: recordTypeId];
}
else if (pickValue == 'Review') {
lstMedicals = [Select Id, Name, Provider_Name__c, Disburse__c, Disbursement_Note__c From Medical_Bill__c WHERE Matter__c =: matterId.Id AND RecordTypeId =: recordTypeId AND Disburse__c = null];
}
else if (pickValue == 'Pay') {
lstMedicals = [Select Id, Name, Provider_Name__c, Disburse__c, Disbursement_Note__c From Medical_Bill__c WHERE Matter__c =: matterId.Id AND RecordTypeId =: recordTypeId AND Disburse__c = 'Yes'];
}
else if (pickValue == 'Dont Pay') {
lstMedicals = [Select Id, Name, Provider_Name__c, Disburse__c, Disbursement_Note__c From Medical_Bill__c WHERE Matter__c =: matterId.Id AND RecordTypeId =: recordTypeId AND Disburse__c = 'No'];
}
else {
lstMedicals = [Select Id, Name, Provider_Name__c, Disburse__c, Disbursement_Note__c from Medical_Bill__c WHERE Matter__c =: matterId.Id AND RecordTypeId =: recordTypeId];
}
}
public pagereference saveme()
{
try
{
System.debug(lstMedicals);
update lstMedicals;
}
catch(DmlException ex)
{
ApexPages.addMessages(ex);
}
return NULL;
}
/* public void sortByFirstName() {
this.sortOrder = 'LastName';
} */
}