• KC Shafer
  • NEWBIE
  • 0 Points
  • Member since 2017
  • Software Developer
  • 1990

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
How would I check if the URL is populated in the below code?
What I would like to do is display 'Open URL' if a URL exists.
If no URL, then I would like to display 'No URL Available' or leave it blank.

 <apex:pageBlockSectionItem >
      <apex:outputLabel value="MY URL" />
     <apex:outputLink value="{!defaultURL.MY_URL__c}" target="_blank">Open URL</apex:outputLink>
 </apex:pageBlockSectionItem>
 
I am trying to create a table that displays Asset__c records grouped by a picklist field, Category__c. I've got the table displaying the Categories, but cannot get the Assets to display. Here's what is looks like now: User-added image
Here's the code I've got so far:
Class
public with sharing class ListViewController {
	
	public List<String> categories {get; set;}
	public List<Asset__c> tessa {get; set;}
	
	public ListViewController(){
		categories = new List<String>();
		Schema.DescribeFieldResult fieldResult = Asset__c.Category__c.getDescribe();
		System.debug(fieldResult);
		List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
		System.debug('--ple-->> ' + ple);
		for(Schema.PicklistEntry f : ple){
			categories.add(f.getLabel());
		}
		tessa = [select Name, Category__c, LastModifiedDate from Asset__c];
	
	}
         
}

Table
<div class="view" id="list">
	<div class="panel panel-default">
		<div class="panel-body">
			<div class="row">
				<div class="col-lg-2">
				<div class="form-group">
					<input type="text" class="form-control input-sm form-control-flat" placeholder="{!$Label.LBL_Search_Asset}" onkeyup="checksearch(this);"/>
				</div>
				</div>
			</div>
			<apex:form id="tableAssets">
				<table id="basic-datatable" class="table table-bordered">
					<thead>
						<tr>
							<th id="first-th" class="click-header" onclick="toogleall(this);"><i class="fa fa-plus-square-o" title="{!$Label.LBL_Show_Hide_All}"></i></th>
							<th width="60%">{!$ObjectType.Asset__c.Fields.Name.Label}</th>
							<th>{!$ObjectType.Asset__c.Fields.LastModifiedDate.Label}</th>
						</tr>
					</thead>
					<tbody>
						<apex:variable var="index" value="{!0}" />
						<apex:repeat value="{!categories}" var="cat">
							<tr class="category-row" id="{!cat}" onclick="togglerows(this);">
								<td class="hidden"><label></label></td>
								<td colspan="3"><i class="fa fa-plus-square-o"></i>&nbsp;&nbsp;<span class="name">{!cat}</span></td>
								<td class="hidden"><span></span></td>
							</tr>
							<apex:repeat value="{!tessa}" var="a">
									<tr class="category-in" style="display:none;">
										<td class="asset-name"><span>{!a.Name}</span></td>
									</tr>
								<apex:variable var="index" value="{!index+1}" />
							</apex:repeat>
						</apex:repeat>
					</tbody>
				</table>
			</apex:form>
		</div>
	</div>
</div>


       
 
Hi Folks, I'm trying to create a visualforce page that is a list view of records (from another object) that are related to the parent object. The reason why I'm going the route of a visualforce page rather than the standard related list, is I would like users to be able to inline edit a field on the related record without navigating off the record detail page of the parent. I was able to get the list view into a visualforce page with inline editing working, but missing a few pieces to polish this up.

Is there a way I can specify which list view to show on the visualforce page and have it stick? If I go to the object and choose another listview from the drop down list, that listview shows on the visualforce page. Also, how do I specify a filter in the list view to only show records related to the parent?