When you double click to inline edit, that doesn't create an input that is bound to the record in your controller via the viewstate, rather it creates a decoupled input on the fly and renders a save button that can save the record via a javascript call to sfdcPage.save().
You could attach some javascript to your Visualforce save button that locates the inline edit save button and if that exists, clicks it. You'd need to be able to detect that the save has completed and then complete your own save though, which I can only see happening by periodically checking for the inline edit save button disappearing. Also, if you were carrying out a save on the same record with other changes from your visualforce page, you'd need to retrieve the record anew from the database and merge your changes in. Add the fact that if the way that inline editing works were to change then your solution would suddenly stop working, and it doesn't look like a robust solution.
If you need the apex:detail behaviour, I'd be inclined to try to move the additional functionality based on field values to a trigger or scheduled apex.
1) As the error says you cannot have the return type of an action method as anything but pagereference, so change it as it expects
public pagereference getReservations() {
return null;
}
2) Since you changed your action function now create a reservation variable to be used in the vf page, instead of returning it in the action method
public List<account> reservations {get;set;}
3) Your like operator will not work so change it
queryString = 'SELECT id, Name, copy_del1__c, UserIdCreatedBy__c, Copy_del1__r.Book__r.Author_Name__c, Copy_del1__r.Book__r.Name, Copy_del1__r.Book__r.Id '+'FROM Reservation__c Where res.Copy_del1__r.Book__r.Name Like Like \'%' + searchString+ '%\'';
Page:
<apex:page controller="ReservationListController" >
<apex:form >
<apex:pageBlock title="Current User Information">
Hello {! $Profile.Name + " " + $User.FirstName + " " + $User.LastName } <br />
Hello ID {! $User.Id } <br />
<apex:outputLink value="~/apex/library_user_edit?id={! $User.Id }" id="editUserLink">Edit My User Information</apex:outputLink>
</apex:pageBlock>
<apex:pageBlock title="Search" >
<apex:inputText value="{!searchString}" id="theSearchString" maxlength="100" size="110" />
<apex:CommandButton Id="btnSearch" action="{!getReservations}" rerender="ReservationsBlock" value="Search" />
</apex:pageBlock>
<apex:pageBlock id="ReservationsBlock" title="Current Reservations">
<apex:pageBlockTable value="{! reservations }" var="res">
<apex:column headerValue="Reservation Name" value="{! res.Name }" />
<apex:column headerValue="Title">
<apex:outputLink value="/{!res.id}"></apex:outputLink>
</apex:column>
<apex:column headerValue="Author" value="{! res.Name}">
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
controller:
public class ReservationListController {
private String profileId;
private String queryString;
private String userId;
public String searchString {get; set; }
public List<Reservation__c> reservations {get;set;}
public ReservationListController (){
getReservations();
}
public pagereference getReservations() {
profileId = userinfo.getProfileId();
userId = userinfo.getUserId();
system.debug('######'+searchString);
if(searchString == null) {searchString = '';}
if(searchString.length() == 0){
queryString = 'SELECT id, Name, copy_del1__c, UserIdCreatedBy__c, Copy_del1__r.Book__r.Author_Name__c, Copy_del1__r.Book__r.Name, Copy_del1__r.Book__r.Id '+'FROM Reservation__c ';
}
else{
queryString = 'SELECT id, Name, copy_del1__c, UserIdCreatedBy__c, Copy_del1__r.Book__r.Author_Name__c, Copy_del1__r.Book__r.Name, Copy_del1__r.Book__r.Id FROM Reservation__c Where res.Copy_del1__r.Book__r.Name Like \'%' + searchString+ '%\'';
}
List<Reservation__c> res = new List<Reservation__c>();
reservations = database.query(queryString);
return null;
}
}
Best Answer
You have written:
which looks like it doesn't render in the browser (though is valid XML so doesn't cause an error because Visualforce allows you to include non-Visualforce tags) rather than using the required Visualforce
apex:column
component: