-
ChatterFeed
-
8Best Answers
-
0Likes Received
-
0Likes Given
-
29Questions
-
42Replies
Visualforce Page extends past page heading
Below is the VF, and the class definitions for the row wrapper follows that.
<apex:form >
<apex:pageBlock id="budget">
<apex:panelGrid columns="4" cellSpacing="10px">
<apex:selectList label="Competency Owner" value="{!selectedCompetencyOwner}" size="1">
<apex:selectOptions value="{!Owners}"/>
</apex:selectList>
<apex:commandButton value="Update" rerender="practices,budget"/>
<apex:commandButton value="Resource Level" />
<apex:commandButton value="Save"/>
</apex:panelGrid>
<table class="list" border="0" cellpadding="0" cellspacing="0">
<tr class="headerRow ">
<apex:repeat value="{!Headings.cellList}" var="h">
<th width="10%">
{!h.value}
</th>
</apex:repeat>
</tr>
<tr>
<td align="right">
{!InputLabel}
</td>
<apex:repeat value="{!inputRow.cellList}" var="i">
<td>
<input type="text" value="{!i.value}" align="right"/>
</td>
</apex:repeat>
</tr>
<apex:repeat value="{!Rows}" var="row">
<tr>
<apex:repeat value="{!row.cellList}" var="c">
<td align="right">
{!c.value}
</td>
</apex:repeat>
</tr>
</apex:repeat>
</table>
</apex:pageBlock>
</apex:form>
</apex:page>
Row wrapper:
public class rowWrapper {
public List<Cell> CellList{get;set;}
}
public class Cell {
public String Value{get;set;}
}
- robertcw777
- January 15, 2014
- Like
- 0
- Continue reading or reply
escape double quotes in !IF
{!IF(l.Name=="Dallas Factory","google.maps.event.trigger(marker, "click");","")}
I get a missing ")" error when I put "click" in double quotes.
Help appreciated.
- robertcw777
- December 24, 2013
- Like
- 0
- Continue reading or reply
reRender from selectList OnChange not functioning properly
I have multilevel selectOptions so the user can select Region, Country, StateProvince and City. I rerender each when the parent selection changesl. However, it only changes the first child of the parent. For example, if the values are "North America, US, TX, Dallas" and then change to Country to Canada, the StateProvince selections change, but the City does not rerender. Also, sometimes I click on the child field and see that it is incorrect. But when I click again, it has been changed to the correct values.
Any help appreciated. Here is my code (note that each geography has an "All" record as a valid selection).
<apex:page standardcontroller="CompetencyOwner__c" Extensions="CompetencyOwnerExt"> <apex:form > <apex:pageBlock > <apex:PageMessages /> <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Cancel" action="{!cancel}"/> <apex:pageBlockTable var="c" value="{!CompetencyOwner__c}" title="Assign Regions"> <apex:column headerValue="Owner"> <apex:selectList value="{!selectedRole}" size="1" required="True" Style="width:150px"> <apex:selectOptions value="{!Roles}"/> </apex:selectList> </apex:column> <apex:column headerValue="Region"> <apex:selectList value="{!selectedRegion}" size="1" required="True" Style="width:150px"> <apex:selectOptions value="{!Regions}"/> <apex:actionSupport event="onchange" rerender="countryID"/> </apex:selectList> </apex:column>
<apex:column headerValue="Country"> <apex:selectList value="{!selectedCountry}" id="countryID" size="1" required="False" Style="width:150px"> <apex:selectOptions value="{!Countries}"/> <apex:actionSupport event="onchange" rerender="stateprovinceID"/> </apex:selectList> </apex:column> <apex:column headerValue="State/Province"> <apex:selectList value="{!selectedStateProvince}" id="stateprovinceID" size="1" required="False" Style="width:150px"> <apex:selectOptions value="{!StateProvinces}"/> <apex:actionSupport event="onchange" rerender="cityID"/> </apex:selectList> </apex:column> <apex:column headerValue="City"> <apex:selectList value="{!selectedCity}" id="cityID" size="1" required="False" Style="width:150px"> <apex:selectOptions value="{!Cities}"/> </apex:selectList> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
Controller:
public class CompetencyOwnerExt{
//note that this code depends upon each geography(region, country,state,city)
//having a record entry named "All"
Public CompetencyOwner__c CompOwner;
public String SelectedRole {get;set;}
public String SelectedRegion{get;set;}
public String SelectedCountry{get;set;}
public String SelectedStateProvince {get;set;}
public String SelectedCity {get;set;}
private final CompetencyOwner__c custobj;
private ApexPages.StandardController controller;
//create a constructor that extends the standard controller
public CompetencyOwnerExt(ApexPages.StandardController controller){
this.controller=controller;
this.custobj=(CompetencyOwner__c)controller.getrecord();
String CompOwnerID=ApexPages.CurrentPage().getparameters().get('ID');
CompOwner=[Select Name, OwnerRole__c,OwnerRoleID__c,Region__c,Country__c,StateProvince__c,City__c
From CompetencyOwner__c where ID=:CompOwnerID];
if(CompOwner==null) {
//this is a new competency owner
CompetencyOwner__c newComp=new CompetencyOwner__c();
insert newComp;
}
else {
//set presets from database
selectedRegion=CompOwner.Region__c;
selectedCountry=CompOwner.Country__c;
selectedStateProvince=CompOwner.StateProvince__c;
selectedCity=CompOwner.City__c;
}
} //end constructor
/********* Regions *********/
public List<selectOption> getRegions() {
List<SelectOption> regionOps=new List<SelectOption>();
List<Region__c> regionList=[Select Name from Region__c Order by Name];
for(Region__c r:regionList) {
regionOps.add(new SelectOption(r.ID,r.Name));
}
}
public String getSelectedRegion() {
return SelectedRegion;
}
public void setSelectedRegion(String SelectedRegion) {
System.debug(LoggingLevel.INFO,'??????????????? selected region set'+SelectedRegion);
this.SelectedRegion=SelectedRegion;
}
/********* End Regions *********/
/********* Countries *********/
public List<selectOption> getCountries() {
List<selectOption> CountryOps=new List <selectOption>();
List<Country__c> CountryList;
Country__c allCountries=[Select Name from Country__c Where Name='All' and Region__c=:selectedRegion Limit 1];
countryOps.add(new selectOption(allCountries.id,allCountries.Name));
CountryList=[Select Name from Country__c Where Region__c=:selectedRegion Order by Name];
for(Country__c co:CountryList) {
if(co.id!=allCountries.id) {
countryOps.add(new selectOption(co.id,co.Name)); //All value already added
}
} //end for
return countryOps;
} //end getCountries
public String getSelectedCountry() {
return SelectedCountry;
}
public void setSelectedCountry(String SelectedCountry) {
this.SelectedCountry=SelectedCountry;
}
/********* end Countries *********/
/********* State Provinces *********/
public List<selectOption> getStateProvinces() {
List<selectOption> stateProvinceOps=new List <selectOption>();
List<State_Province__c> stateProvinceList;
//get ID for All selection
State_Province__c allStateProvinces=[Select Name from State_Province__c Where Name='All' and Country__c=:selectedCountry Limit 1];
stateProvinceOps.add(new selectOption(allStateProvinces.id,AllStateProvinces.Name));
stateProvinceList=[Select Name from State_Province__c Where Country__c=:selectedCountry Order by Name];
for(State_Province__c sp:stateProvinceList) {
if(sp.id!=allStateProvinces.id) {
stateProvinceOps.add(new selectOption(sp.id,sp.Name));
}
}
return StateProvinceOps;
} //end getStateProvinces
public String getSelectedStateProvince() {
return SelectedStateProvince;
}
public void setSelectedStateProvince(String SelectedStateProvince) {
this.SelectedStateProvince=SelectedStateProvince;
}
/********* Cities *********/
public List<selectOption> getCities() {
List<selectOption> CityOps=new List <selectOption>();
List<City__c> CityList;
//default for cityList is All
City__c allCities=[Select Name from City__c Where Name='All' and StateProvince__c=:selectedStateProvince Limit 1];
cityOps.add(new selectOption(allCities.id,allCities.Name));
cityList=[Select Name from City__c Where stateProvince__c=:selectedStateProvince Order by Name];
for(City__c ci:cityList) {
if(ci.id!=allCities.id) {
cityOps.add(new selectOption(ci.id,ci.Name));
}
}
return CityOps;
} //end getCities
public String getSelectedCity() {
return SelectedCity;
}
public void setSelectedCity(String CityProvince) {
this.selectedCity=SelectedCity;
}
- robertcw777
- November 12, 2013
- Like
- 0
- Continue reading or reply
Same infowindow opens for all markers in google map
My VF page opens a google map and adds multiple locations based on an list returned from the controller. The markers display fine with the correct names displayed on the mouseover. However, whenever I click to view the infoWindow, it always opens the infowindow for the last location added. Can anyone see what I'm doing wrong?
Thanks.
<apex:page Controller="LocationMapController2">
<head>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var myOptions = {
zoom: 2,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: new google.maps.LatLng(40,-95),
mapTypeControl: false
}
var map;
var marker;
//create map
map = new google.maps.Map(document.getElementById("map"), myOptions);
var geocoder = new google.maps.Geocoder();
<apex:repeat var="l" value="{!LocationInfo}">
var address = "{!l.Street__c}, " + "{!l.City__r.Name}, " + "{!l.City__r.Name}, " + "{!l.Country__r.Name}";
var infowindow = new google.maps.InfoWindow({
content: "<b>{!l.Name}</b><br>{!l.Street__c}<br>{!l.City__r.Name}, {!l.City__r.Name}<br>{!l.Country__c}"
});
geocoder.geocode( { address: address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK && results.length) {
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
//create marker
marker = new google.maps.Marker({
position: results[0].geometry.location,
map: map,
title: "{!l.Name}"
});
//add listeners
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
google.maps.event.addListener(infowindow, 'closeclick', function() {
map.setCenter(marker.getPosition());
});
}
} else {
$('#map').css({'height' : '15px'});
$('#map').html("Oops! {!l.Name}'s address could not be found, please make sure the address is correct.");
resizeIframe();
}
});
</apex:repeat>
function resizeIframe() {
var me = window.name;
if (me) {
var iframes = parent.document.getElementsByName(me);
if (iframes && iframes.length == 1) {
height = document.body.offsetHeight;
iframes[0].style.height = height + "px";
}
}
}
});
</script>
<style>
#map {
font-family: Arial;
font-size:12px;
line-height:normal !important;
height:500px;
background:transparent;
}
</style>
</head>
<body>
<div id="map"></div>
</body>
</apex:page>
- robertcw777
- October 14, 2013
- Like
- 0
- Continue reading or reply
Upper and Lower Bounds on Visualforce Gauge
I'm using VF charting to display a gauge on a page. I can't see anyway to set different colors for upper and lower bounds on the gauge face. For example, I want to have the gauge show a range or -100 to +100, and have the gauge face show up as green between +/- 20, Yellow between 20 and 40 and -20 and -40, and red outside those limits. I know you can set color sections like this on the saleforce dashboard gauage, but can't see any way to do in VF. I can set two colors in the apex:gaugeSeries so that it shows one color left of the needle and another above the needle, but I need to have a static display with different colors on the gauge face itself. Appreciate if someone knows if this can or can't be done.
- robertcw777
- October 06, 2013
- Like
- 0
- Continue reading or reply
InputType based on Cell Value
I'm rendering a table of text values, and I want to make each cell editable based on a value in a wrapper around the cell value. Here is the wrapper definition for the rows and cells:
public class rowWrapper {
public List<Cell> CellList{get;set;}
}
public class Cell {
public String Value{get;set;}
public Boolean Input{get;set;} //true if cell allows input
}
This is what I'm trying to do:
<apex:repeat value="{!Rows}" var="row">
<tr>
<apex:repeat value="{!row.cellList}" var="c">
<td align="right">
"{!If(c.input, "<input type="text" value="{!c.value}" name="inputtype" />" ,"{!c.value}") }"
</td>
</apex:repeat>
</tr>
</apex:repeat>
I get a syntax error "Line 1 Syntax Error. Missing )
Am I on the right path here to do what I want to do? Is this an issue with nested quotations?
Thanks.
- robertcw777
- September 08, 2013
- Like
- 0
- Continue reading or reply
Google Map VF Page Position
I am trying to display a Google map on a dashboard with markers to indicate status at several locations. I obtained the VF code below from the forum that does do what I want, but it offsets the map on the page leaving a blank space of about 30% of the page width to the left. I don' t really want to become an expert on Google maps since I only need it for this one case. Also, I'm famiilar with HTML, but not an expert. Is there anyone who can explain why I'm getting the blank space, and how I can control the position of the map on the page? Would save me a lot of time and a headache. Thanks!
<apex:page Controller="LocationMapController2">
<head>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var myOptions = {
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false
}
var map;
var marker;
var geocoder = new google.maps.Geocoder();
var address = "{!LocationInfo.Street__c}, " + "{!LocationInfo.City__r.Name}, " + "{!LocationInfo.PostalCode__c}, " + "{!LocationInfo.Country__r.Name}";
var infowindow = new google.maps.InfoWindow({
content: "<b>{!LocationInfo.Name}</b><br>{!LocationInfo.Street__c}<br>{!LocationInfo.City__r.Name}, {!LocationInfo.PostalCode__c}<br>{!LocationInfo.Country__c}"
});
geocoder.geocode( { address: address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK && results.length) {
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
//create map
map = new google.maps.Map(document.getElementById("map"), myOptions);
//center map
map.setCenter(results[0].geometry.location);
//create marker
marker = new google.maps.Marker({
position: results[0].geometry.location,
map: map,
title: "{!LocationInfo.Name}"
});
//add listeners
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
google.maps.event.addListener(infowindow, 'closeclick', function() {
map.setCenter(marker.getPosition());
});
}
} else {
$('#map').css({'height' : '15px'});
$('#map').html("Oops! {!LocationInfo.Name}'s billing address could not be found, please make sure the address is correct.");
resizeIframe();
}
});
function resizeIframe() {
var me = window.name;
if (me) {
var iframes = parent.document.getElementsByName(me);
if (iframes && iframes.length == 1) {
height = document.body.offsetHeight;
iframes[0].style.height = height + "px";
}
}
}
});
</script>
<style>
#map {
font-family: Arial;
font-size:12px;
line-height:normal !important;
height:250px;
background:transparent;
}
</style>
</head>
<body>
<div id="map"></div>
</body>
</apex:page>
- robertcw777
- July 26, 2013
- Like
- 0
- Continue reading or reply
Sharing variables on included visualforce pages
I have a visualforce page that shows charts that I would like to filter based on a filter header settings. For example, when the user selects a specific Country, the charts will be rerendered for just that country data. Below is the controller for the filter page showing the dropdown values. Below that is the master page that includes the filter page, and other visualforce pages that display the charts, each with its own controller. How can I share the value of the dropdown selection wiht the controllers for the included pages?
Thanks!
public with Sharing class PracticeFilterClass{
// public List<SelectOption> Filter {get;set;}
public String SelectedFilter{get;set;}
public String SelectedRegion{get;set;}
public String SelectedCountry{get;set;}
public String SelectedStateProvince{get;set;}
public String SelectedCity{get;set;}
public String SelectedRole{get;set;}
etc...
VisualForcePage:
<apex:page >
<apex:include pageName="FilterHeaderPage"/>
<apex:include pageName="MyDashboardInfo"/>
<apex:include pageName="MyDashboardRow2"/>
</apex:page>
- robertcw777
- July 17, 2013
- Like
- 0
- Continue reading or reply
Set selectList Default Value based on Record Value
I have set up a VF page to replace the edit page for a custom object “CompetencyOwner__c”. The object contains two fields “Region__c” and “Country__c” which I want to be able to let the user change with selectLists. I have no problem building the selectOption values and making the Country values dependent on the selected Region. My problem is that I don’t understand how to set the default value of the dropdowns based on the current record values of those fields.
I have a getter method to return the list of selectList values to populate the dropdowns. I also have getter and setter methods for the current value of the selection. Here’s an example for the Region field:
String selectedRegion; //for selected value
public List<selectOption> getRegions() {
List<SelectOption> regionOps=new List<SelectOption>();
List<Region__c> regionList=[Select Name from Region__c Order by Name];
for(Region__c r:regionList) {
regionOps.add(new SelectOption(r.ID,r.Name));
}
return regionOps;
}
public String getSelectedRegion() {
return SelectedRegion;
}
public void setSelectedRegion(String SelectedRegion) {
this.SelectedRegion=SelectedRegion;
}
Assume I can get the actual record to be edited. How do I set the initial value of the dropdown to the selectOption that corresponds to the record ID or Name?
- robertcw777
- April 12, 2013
- Like
- 0
- Continue reading or reply
OutputLink not rendering as link
I have a puzzling problem where an outputlink is not rendering as a hyperlink to an VF page and nothing happens when I click on it, even though it appears that the html is rendering correctly.
See the outputlink in the VF column "Work" below::
<apex:page controller="MyWorkController">
<apex:form>
<apex:pageblock >
<apex:pageblocktable value="{!WorkTable}" var="w">
<apex:column headervalue="Next Action">
<apex:outputText value="{0,date,MM'/'dd'/'yyyy}" style="{!w.NextActionStyle}">
<apex:param value="{!w.NextActionDate}"/>
</apex:outputText>
</apex:column>
<apex:column headervalue="Due Date">
<apex:outputText value="{0,date,MM'/'dd'/'yyyy}" style="{!w.DueStyle}">
<apex:param value="{!w.DueDate}"/>
</apex:outputText>
</apex:column>
<apex:column headervalue="Type">
<apex:outputtext value="{!w.WorkItemType}"/>
</apex:column>
<apex:column headervalue="Work">
<apex:outputlink value="/{!w.WorkItemID}"/>
{!w.WorkItemName}
</apex:column>
</apex:pageblocktable>
</apex:pageblock>
</apex:form>
</apex:page>
Here is the html.
colspan="1"><a href="https://na14.salesforce.com/a0Kd00000036RrYEAU"></a>
Seattle P2 Audit</td>
and this link works if I copy and paste it into the browser (I’m using Firefox)
The VF page cell is just rendered as if it were just an outputtext field.
Any ideas?
- robertcw777
- April 01, 2013
- Like
- 0
- Continue reading or reply
Working Google Map Example?
I've done quite a bit of research on the forums on how to include a "simple" Google Map example, and have tried many of them. With all , I seem to end up in the same place as a lot of others end up based on the forum comments - the map never actually comes up. I have a valid API key that I substitute, and still nothing comes up - just a blank VF page. Does anyone have a real working example that I could review and modify?
I just want to display a set of locations on the map. In my case, location is a custom object with country, state,city and zip (not a standard account record). If I can just get something basic working (i.e. actually see a map), I can then modify it to also set the marker colors based on some properties of the location - it's for a dashboard.
Any help would be greatly appreciated (something in API V3 would be best, but at least an example that works). I thought this was going to be simple...
- robertcw777
- March 10, 2013
- Like
- 0
- Continue reading or reply
Close VisualForce Page and Refresh Detail Record Page
I want to open a visualforce page from a custom button on a custom object detail page. The user selects a value in a tree dispayed in a VF page, and then clicks on a save button. I would like to update a record on the custom object, close the VF page, and then refresh the detail page so the record updates (updating the field itself would be better).
I've tried all kinds of solutions for similar situations on the web, but can't get any to work. Does someone know how to do this?
Thanks!
Here is VF:
<apex:page id="CompetencyRolesPage" StandardController="Competency__c" Extensions="TestPageController">
<apex:form >
<apex:outputPanel rendered="{!validRoleID}">
<c:TreeView selectable="true" roleOrUserId="{!RoleID}" value="{!selectedValues}" />
<apex:commandButton value="Save" action="{!saveRole}" />
</apex:outputPanel>
</apex:form>
</apex:page>
Here arerelevant pieces from controller:
public String selectedValues {get; set;}
public String userRoleID {get;set;}
public Boolean getValidRoleID() {
If(null==UserInfo.getUserRoleID())
return false;
else
return true;
}
public String getRoleID() {
userRoleId=UserInfo.getUserRoleID();
return userRoleID;
}
public PageReference saveRole() {
//will update customer field in detail record here.
return null;
}
- robertcw777
- March 08, 2013
- Like
- 0
- Continue reading or reply
Dependent SelectLists in PageBlockTable
I’m trying to create a Country selectList within a table row based on the Region selected in another selectList in that row. The Country selectList should be updated based on the region selected. My Country object is a child of Region object.
I’m getting some strange results. For example, when I select a Region in a record, the Country list is sometimes set to “All” with no Country values in the dropdown. Sometimes, it does work. And, sometimes it gets the wrong Countries for the Region. Can anybody tell me what’s wrong with what I have below? Thanks.
<apex:page controller="CompetencyOwnerController">
<apex:form >
<apex:pageblock id="CompetencyOwner">
<apex:pageblocktable value="{!CompetencyOwners}" var="c">
<apex:column headerValue="Region">
<apex:selectList value="{!regionValue}" size="1">
<apex:selectOptions value="{!RegionChoices}"/>
<apex:actionSupport event="onchange" rerender="countryList"/>
</apex:selectList>
</apex:column>
<apex:column headerValue="Country">
<apex:selectList id= "countryList" value="{!countryValue}" size="1" style="width:300px">
<apex:selectOptions value="{!CountryChoices}"/>
<apex:actionSupport event="onchange"/>
</apex:selectList>
</apex:column>
</apex:pageblocktable>
</apex:pageblock>
</apex:form>
</apex:page>
public class CompetencyOwnerController {
Public List <CompetencyOwner__c> compOwnerData{get;set;}
Public String regionValue{get;set;}
Public String countryValue{get;set;}
Public String stateProvinceValue{get;set;}
String[] Regions=new String[] {};
public List <CompetencyOwner__c> getCompetencyOwners() {
compOwnerData = [Select Name from CompetencyOwner__c];
return compOwnerData;
}
Controller:
public List<SelectOption> getRegionChoices() {
List<SelectOption> regionOptions = new List<SelectOption>();
List <Region__c> regions=[Select ID, Name from Region__c];
regionOptions.add(new SelectOption('All',''));
for(Region__c r:regions) {
regionOptions.add(new SelectOption(r.ID,r.Name));
}
System.debug(LoggingLevel.Info,'+++++++++ value after region init '+regionValue);
return regionoptions;
} /* end getRegionChoices */
public List<SelectOption> getCountryChoices() {
List<SelectOption> countryOptions = new List<SelectOption>();
If(null!=regionValue) {
System.debug(LoggingLevel.Info,'???????????? '+regionValue);
List <Country__c> countries=[Select ID,Name from Country__c where Region__c=:regionValue];
countryOptions.add(new SelectOption('All','All'));
for(Country__c co:countries) {
countryOptions.add(new SelectOption(co.ID,co.Name));
}
}
return countryOptions;
} /* end getRegionChoices */
}
- robertcw777
- March 02, 2013
- Like
- 0
- Continue reading or reply
Fix Scale on Visualforce Chart
Is there any way to fix a scale and scale interval on a visualforce chart? I'm plotting a bar series that looks like:
x y
-30 1
-20 5
-10 8
+10 3
+20 4
+30 6
It anchors the vertical barchart y axis scale at 1 and the top at 9, therefore, there is no bar shown for the first point at x=-30. I guess in a series starting at x=0 you could add another element at 0,0, but that doesn't work here. I can' t see any way in the documentation to set the scale, I also have the case where they y-values need to be whole numbers, yet it shows the scale in increments of 0.5,
- robertcw777
- February 19, 2013
- Like
- 0
- Continue reading or reply
Display Child Records in Table
I have a custom object Parent__c and child records Child__c. I want to show fields from the child record that corresponds with its parent record. But, I want the titles for each child column to appear only at the top of the Visualforce table. Like:
Parent Field TItle Child Field 1 Title Child Field 2 Title Child Field 3 TItle
P1.Value P1.C1.Value P1.C1.Value P1.C1.Value
P1.C2.Value P1.C2.Value P1.C2.Value
P2.Value P2.C1.Value P2.C1.Value P2.C1.Value
P2.C2.Value P2.C2.Value P2.C2.Value
P2.C3.Value P2.C3.Value P2.C3.Value
etc.
Does anyone know how to do this?
Thanks!
- robertcw777
- January 24, 2013
- Like
- 0
- Continue reading or reply
Headings in Parent-Child Table
I am showing a table that includes records from parent and child objects. I have something working OK, except that it repeats headings for the child records in each parent row.
Here is query:
CompChanges = [Select Name,(Select Maturity__r.Name,Total__c,ScheduleTracking__c,ExpenseTracking__c,
CapitalTracking__c,LateStart__c,Late__c
From dbPracticeChanges__r) From Competency__c];
Using the VF below the picture, I get child table headers in each parent row. I really want to have the child headers appear in the top of the table one time. How can I change the VF below the table to do that? Any help much appreciated.
<apex:page controller="dbPracticeChangesController">
<apex:form >
<apex:pageblock >
<apex:pageblocktable value="{!ChangeList}" var="cs">
<apex:column headervalue="Competency">
<apex:outputtext value="{!cs.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">
Practice Status
</apex:facet>
<apex:pageblocktable value="{!cs.dbPracticeChanges__r}" var="db">
<apex:column headervalue="Maturity">
<apex:outputtext value="{!db.Maturity__r.Name}"/>
</apex:column>
<apex:column headervalue="Total">
<apex:outputtext value="{!db.Total__c}"/>
</apex:column>
<apex:column headervalue="Schedule">
<apex:outputtext value="{!db.ScheduleTracking__c}"/>
</apex:column>
<apex:column headervalue="Expense">
<apex:outputtext value="{!db.ExpenseTracking__c}"/>
</apex:column>
<apex:column headervalue="Capital">
<apex:outputtext value="{!db.CapitalTracking__c}"/>
</apex:column>
<apex:column headervalue="Late Start">
<apex:outputtext value="{!db.LateStart__c}"/>
</apex:column>
<apex:column headervalue="Late">
<apex:outputtext value="{!db.Late__c}"/>
</apex:column>
</apex:pageblocktable>
</apex:column>
</apex:pageblocktable>
</apex:pageblock>
</apex:form>
</apex:page>
- robertcw777
- January 12, 2013
- Like
- 0
- Continue reading or reply
Nested Pageblock Tables
I need to group and display child object fields by parent object fields in a nested VisualForce Pageblock. For example, Parent__c is the parent of Child__c. I'd like to display a table with the name of the parent in a row, and then show fields of Child__c for each name.
Parent Child
Name1 Field1
Field2
Field3
Name2 Field1
Field2
Field3
etc.
I know how to do the parent child query in the controller:
List <Parent__c> ParentChildList{get;set;}
Public LIst <Parent__c> getQueryList() {
ParentChildList = [Select Name,(Select Field1__c,Field2__c From Child__c) From Parent__c];
return ParentChildList;
}
I'm having trouble with the nested PageBlock tables in the VisualForce page (using apex:facet) that reference the data returned by the controller to show the nested table above. Help would be much appreciated.
- robertcw777
- January 10, 2013
- Like
- 0
- Continue reading or reply
New Custom Object from VisualForce Page
I have a custom object called Displine__c. I want to create a VF page that has a New button that will open the new record page for this object, and then rerender the page (there is a tableblock below that should be refreshed to show the new record). I couldn't find any way to do this. Help?
- robertcw777
- December 17, 2012
- Like
- 0
- Continue reading or reply
Special characters (&) on strings passed to popup page
I’m running into a problem passing a string with an & to a popup page. It causes the string to be truncated at the point of the "&" when I use the string within the popup page controller. I presume I’m dealing with special character issues in the string. Looked around and couldn’t find anything on how to deal with special characters when passing parameters from html to a new page. Do I need to prevent special characters in the string (i.e. check with CONTAINS(&) ) when string is originally entered, or can I escape special characters in this case? If I have to prevent, any other special characters I need to prevent?
Here’s where I set the onclick and pass parameters to javascript function “drilldown”:
<td>
<a href="#" onclick="return drilldown('{!cell.column}','{!cell.value}','{!cell.competency}','{!cell.maturity}','{! cell.location}')">{!cell.value}</a>
</td>
The location with the & is “Spokane R&D”. When the html is rendered, it replaces the & with “&:” as shown below:
<td>
<a href="#" onclick="return drilldown('4','0','AAA','Best Practice','Spokane R&D')">0</a>
</td>
This is the javascript function “drilldown”:
<script type="text/javascript">
function drilldown(column,cellvalue,competency,maturity,location){
var w=window.open('/apex/CompetencyDrillDownPage?colVar='+column +'&cellVar='+cellvalue+'&compVar='+competency+'&matVar='+maturity+'&locVar='+location,target='_blank')
return False;
};
</script>
From the new page controller:
PageReference PageRef = ApexPages.currentpage();
String column = PageRef.getParameters().get('colVAR');
String value = PageRef.getParameters().get('cellVAR');
String competency = PageRef.getParameters().get('compVAR');
String maturity = PageRef.getParameters().get('matVAR');
String location = PageRef.getParameters().get('locVAR');
public List<PracticeLocationJTN__c> getPracticesandChoices()
{
System.debug(LoggingLevel.Info, 'xxxx location= '+location);
This is the output of the debug log:
08:40:05.140 (140336000)|USER_DEBUG|[31]|INFO|xxxx location= Spokane R
- robertcw777
- November 12, 2012
- Like
- 0
- Continue reading or reply
Pass Variable From JavaScript Function on Open.WIndow
I have to pass a string that is a variable of a Javascript function to the new visualforce page controller using open.window. I know you can pass an explicit string value with open.window, like:
var w=window.open('URL?variable=value')
and then use PageReference.getparameters to get the string. However, in mycase, the string comes from a Javascript onclick function, so the string value is known only at run-time. In the code below, I know that getparameters will just provide the string "drilldownparm", instead of the actual value of drilldownparm when the new page is opened. How can I pass the contents of drilldownparm to the new page?
Thanks.
<script type="text/javascript">
function drilldown(drilldownparm) {
var w=window.open('/apex/CompetencyDrillDownPage?testvalue=drilldownparm',target='_blank')
return false
}
</script>
- robertcw777
- October 21, 2012
- Like
- 0
- Continue reading or reply
Visualforce Page extends past page heading
Below is the VF, and the class definitions for the row wrapper follows that.
<apex:form >
<apex:pageBlock id="budget">
<apex:panelGrid columns="4" cellSpacing="10px">
<apex:selectList label="Competency Owner" value="{!selectedCompetencyOwner}" size="1">
<apex:selectOptions value="{!Owners}"/>
</apex:selectList>
<apex:commandButton value="Update" rerender="practices,budget"/>
<apex:commandButton value="Resource Level" />
<apex:commandButton value="Save"/>
</apex:panelGrid>
<table class="list" border="0" cellpadding="0" cellspacing="0">
<tr class="headerRow ">
<apex:repeat value="{!Headings.cellList}" var="h">
<th width="10%">
{!h.value}
</th>
</apex:repeat>
</tr>
<tr>
<td align="right">
{!InputLabel}
</td>
<apex:repeat value="{!inputRow.cellList}" var="i">
<td>
<input type="text" value="{!i.value}" align="right"/>
</td>
</apex:repeat>
</tr>
<apex:repeat value="{!Rows}" var="row">
<tr>
<apex:repeat value="{!row.cellList}" var="c">
<td align="right">
{!c.value}
</td>
</apex:repeat>
</tr>
</apex:repeat>
</table>
</apex:pageBlock>
</apex:form>
</apex:page>
Row wrapper:
public class rowWrapper {
public List<Cell> CellList{get;set;}
}
public class Cell {
public String Value{get;set;}
}
- robertcw777
- January 15, 2014
- Like
- 0
- Continue reading or reply
escape double quotes in !IF
{!IF(l.Name=="Dallas Factory","google.maps.event.trigger(marker, "click");","")}
I get a missing ")" error when I put "click" in double quotes.
Help appreciated.
- robertcw777
- December 24, 2013
- Like
- 0
- Continue reading or reply
reRender from selectList OnChange not functioning properly
I have multilevel selectOptions so the user can select Region, Country, StateProvince and City. I rerender each when the parent selection changesl. However, it only changes the first child of the parent. For example, if the values are "North America, US, TX, Dallas" and then change to Country to Canada, the StateProvince selections change, but the City does not rerender. Also, sometimes I click on the child field and see that it is incorrect. But when I click again, it has been changed to the correct values.
Any help appreciated. Here is my code (note that each geography has an "All" record as a valid selection).
<apex:page standardcontroller="CompetencyOwner__c" Extensions="CompetencyOwnerExt"> <apex:form > <apex:pageBlock > <apex:PageMessages /> <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Cancel" action="{!cancel}"/> <apex:pageBlockTable var="c" value="{!CompetencyOwner__c}" title="Assign Regions"> <apex:column headerValue="Owner"> <apex:selectList value="{!selectedRole}" size="1" required="True" Style="width:150px"> <apex:selectOptions value="{!Roles}"/> </apex:selectList> </apex:column> <apex:column headerValue="Region"> <apex:selectList value="{!selectedRegion}" size="1" required="True" Style="width:150px"> <apex:selectOptions value="{!Regions}"/> <apex:actionSupport event="onchange" rerender="countryID"/> </apex:selectList> </apex:column>
<apex:column headerValue="Country"> <apex:selectList value="{!selectedCountry}" id="countryID" size="1" required="False" Style="width:150px"> <apex:selectOptions value="{!Countries}"/> <apex:actionSupport event="onchange" rerender="stateprovinceID"/> </apex:selectList> </apex:column> <apex:column headerValue="State/Province"> <apex:selectList value="{!selectedStateProvince}" id="stateprovinceID" size="1" required="False" Style="width:150px"> <apex:selectOptions value="{!StateProvinces}"/> <apex:actionSupport event="onchange" rerender="cityID"/> </apex:selectList> </apex:column> <apex:column headerValue="City"> <apex:selectList value="{!selectedCity}" id="cityID" size="1" required="False" Style="width:150px"> <apex:selectOptions value="{!Cities}"/> </apex:selectList> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
Controller:
public class CompetencyOwnerExt{
//note that this code depends upon each geography(region, country,state,city)
//having a record entry named "All"
Public CompetencyOwner__c CompOwner;
public String SelectedRole {get;set;}
public String SelectedRegion{get;set;}
public String SelectedCountry{get;set;}
public String SelectedStateProvince {get;set;}
public String SelectedCity {get;set;}
private final CompetencyOwner__c custobj;
private ApexPages.StandardController controller;
//create a constructor that extends the standard controller
public CompetencyOwnerExt(ApexPages.StandardController controller){
this.controller=controller;
this.custobj=(CompetencyOwner__c)controller.getrecord();
String CompOwnerID=ApexPages.CurrentPage().getparameters().get('ID');
CompOwner=[Select Name, OwnerRole__c,OwnerRoleID__c,Region__c,Country__c,StateProvince__c,City__c
From CompetencyOwner__c where ID=:CompOwnerID];
if(CompOwner==null) {
//this is a new competency owner
CompetencyOwner__c newComp=new CompetencyOwner__c();
insert newComp;
}
else {
//set presets from database
selectedRegion=CompOwner.Region__c;
selectedCountry=CompOwner.Country__c;
selectedStateProvince=CompOwner.StateProvince__c;
selectedCity=CompOwner.City__c;
}
} //end constructor
/********* Regions *********/
public List<selectOption> getRegions() {
List<SelectOption> regionOps=new List<SelectOption>();
List<Region__c> regionList=[Select Name from Region__c Order by Name];
for(Region__c r:regionList) {
regionOps.add(new SelectOption(r.ID,r.Name));
}
}
public String getSelectedRegion() {
return SelectedRegion;
}
public void setSelectedRegion(String SelectedRegion) {
System.debug(LoggingLevel.INFO,'??????????????? selected region set'+SelectedRegion);
this.SelectedRegion=SelectedRegion;
}
/********* End Regions *********/
/********* Countries *********/
public List<selectOption> getCountries() {
List<selectOption> CountryOps=new List <selectOption>();
List<Country__c> CountryList;
Country__c allCountries=[Select Name from Country__c Where Name='All' and Region__c=:selectedRegion Limit 1];
countryOps.add(new selectOption(allCountries.id,allCountries.Name));
CountryList=[Select Name from Country__c Where Region__c=:selectedRegion Order by Name];
for(Country__c co:CountryList) {
if(co.id!=allCountries.id) {
countryOps.add(new selectOption(co.id,co.Name)); //All value already added
}
} //end for
return countryOps;
} //end getCountries
public String getSelectedCountry() {
return SelectedCountry;
}
public void setSelectedCountry(String SelectedCountry) {
this.SelectedCountry=SelectedCountry;
}
/********* end Countries *********/
/********* State Provinces *********/
public List<selectOption> getStateProvinces() {
List<selectOption> stateProvinceOps=new List <selectOption>();
List<State_Province__c> stateProvinceList;
//get ID for All selection
State_Province__c allStateProvinces=[Select Name from State_Province__c Where Name='All' and Country__c=:selectedCountry Limit 1];
stateProvinceOps.add(new selectOption(allStateProvinces.id,AllStateProvinces.Name));
stateProvinceList=[Select Name from State_Province__c Where Country__c=:selectedCountry Order by Name];
for(State_Province__c sp:stateProvinceList) {
if(sp.id!=allStateProvinces.id) {
stateProvinceOps.add(new selectOption(sp.id,sp.Name));
}
}
return StateProvinceOps;
} //end getStateProvinces
public String getSelectedStateProvince() {
return SelectedStateProvince;
}
public void setSelectedStateProvince(String SelectedStateProvince) {
this.SelectedStateProvince=SelectedStateProvince;
}
/********* Cities *********/
public List<selectOption> getCities() {
List<selectOption> CityOps=new List <selectOption>();
List<City__c> CityList;
//default for cityList is All
City__c allCities=[Select Name from City__c Where Name='All' and StateProvince__c=:selectedStateProvince Limit 1];
cityOps.add(new selectOption(allCities.id,allCities.Name));
cityList=[Select Name from City__c Where stateProvince__c=:selectedStateProvince Order by Name];
for(City__c ci:cityList) {
if(ci.id!=allCities.id) {
cityOps.add(new selectOption(ci.id,ci.Name));
}
}
return CityOps;
} //end getCities
public String getSelectedCity() {
return SelectedCity;
}
public void setSelectedCity(String CityProvince) {
this.selectedCity=SelectedCity;
}
- robertcw777
- November 12, 2013
- Like
- 0
- Continue reading or reply
Same infowindow opens for all markers in google map
My VF page opens a google map and adds multiple locations based on an list returned from the controller. The markers display fine with the correct names displayed on the mouseover. However, whenever I click to view the infoWindow, it always opens the infowindow for the last location added. Can anyone see what I'm doing wrong?
Thanks.
<apex:page Controller="LocationMapController2">
<head>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var myOptions = {
zoom: 2,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: new google.maps.LatLng(40,-95),
mapTypeControl: false
}
var map;
var marker;
//create map
map = new google.maps.Map(document.getElementById("map"), myOptions);
var geocoder = new google.maps.Geocoder();
<apex:repeat var="l" value="{!LocationInfo}">
var address = "{!l.Street__c}, " + "{!l.City__r.Name}, " + "{!l.City__r.Name}, " + "{!l.Country__r.Name}";
var infowindow = new google.maps.InfoWindow({
content: "<b>{!l.Name}</b><br>{!l.Street__c}<br>{!l.City__r.Name}, {!l.City__r.Name}<br>{!l.Country__c}"
});
geocoder.geocode( { address: address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK && results.length) {
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
//create marker
marker = new google.maps.Marker({
position: results[0].geometry.location,
map: map,
title: "{!l.Name}"
});
//add listeners
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
google.maps.event.addListener(infowindow, 'closeclick', function() {
map.setCenter(marker.getPosition());
});
}
} else {
$('#map').css({'height' : '15px'});
$('#map').html("Oops! {!l.Name}'s address could not be found, please make sure the address is correct.");
resizeIframe();
}
});
</apex:repeat>
function resizeIframe() {
var me = window.name;
if (me) {
var iframes = parent.document.getElementsByName(me);
if (iframes && iframes.length == 1) {
height = document.body.offsetHeight;
iframes[0].style.height = height + "px";
}
}
}
});
</script>
<style>
#map {
font-family: Arial;
font-size:12px;
line-height:normal !important;
height:500px;
background:transparent;
}
</style>
</head>
<body>
<div id="map"></div>
</body>
</apex:page>
- robertcw777
- October 14, 2013
- Like
- 0
- Continue reading or reply
Upper and Lower Bounds on Visualforce Gauge
I'm using VF charting to display a gauge on a page. I can't see anyway to set different colors for upper and lower bounds on the gauge face. For example, I want to have the gauge show a range or -100 to +100, and have the gauge face show up as green between +/- 20, Yellow between 20 and 40 and -20 and -40, and red outside those limits. I know you can set color sections like this on the saleforce dashboard gauage, but can't see any way to do in VF. I can set two colors in the apex:gaugeSeries so that it shows one color left of the needle and another above the needle, but I need to have a static display with different colors on the gauge face itself. Appreciate if someone knows if this can or can't be done.
- robertcw777
- October 06, 2013
- Like
- 0
- Continue reading or reply
Sharing variables on included visualforce pages
I have a visualforce page that shows charts that I would like to filter based on a filter header settings. For example, when the user selects a specific Country, the charts will be rerendered for just that country data. Below is the controller for the filter page showing the dropdown values. Below that is the master page that includes the filter page, and other visualforce pages that display the charts, each with its own controller. How can I share the value of the dropdown selection wiht the controllers for the included pages?
Thanks!
public with Sharing class PracticeFilterClass{
// public List<SelectOption> Filter {get;set;}
public String SelectedFilter{get;set;}
public String SelectedRegion{get;set;}
public String SelectedCountry{get;set;}
public String SelectedStateProvince{get;set;}
public String SelectedCity{get;set;}
public String SelectedRole{get;set;}
etc...
VisualForcePage:
<apex:page >
<apex:include pageName="FilterHeaderPage"/>
<apex:include pageName="MyDashboardInfo"/>
<apex:include pageName="MyDashboardRow2"/>
</apex:page>
- robertcw777
- July 17, 2013
- Like
- 0
- Continue reading or reply
Set selectList Default Value based on Record Value
I have set up a VF page to replace the edit page for a custom object “CompetencyOwner__c”. The object contains two fields “Region__c” and “Country__c” which I want to be able to let the user change with selectLists. I have no problem building the selectOption values and making the Country values dependent on the selected Region. My problem is that I don’t understand how to set the default value of the dropdowns based on the current record values of those fields.
I have a getter method to return the list of selectList values to populate the dropdowns. I also have getter and setter methods for the current value of the selection. Here’s an example for the Region field:
String selectedRegion; //for selected value
public List<selectOption> getRegions() {
List<SelectOption> regionOps=new List<SelectOption>();
List<Region__c> regionList=[Select Name from Region__c Order by Name];
for(Region__c r:regionList) {
regionOps.add(new SelectOption(r.ID,r.Name));
}
return regionOps;
}
public String getSelectedRegion() {
return SelectedRegion;
}
public void setSelectedRegion(String SelectedRegion) {
this.SelectedRegion=SelectedRegion;
}
Assume I can get the actual record to be edited. How do I set the initial value of the dropdown to the selectOption that corresponds to the record ID or Name?
- robertcw777
- April 12, 2013
- Like
- 0
- Continue reading or reply
OutputLink not rendering as link
I have a puzzling problem where an outputlink is not rendering as a hyperlink to an VF page and nothing happens when I click on it, even though it appears that the html is rendering correctly.
See the outputlink in the VF column "Work" below::
<apex:page controller="MyWorkController">
<apex:form>
<apex:pageblock >
<apex:pageblocktable value="{!WorkTable}" var="w">
<apex:column headervalue="Next Action">
<apex:outputText value="{0,date,MM'/'dd'/'yyyy}" style="{!w.NextActionStyle}">
<apex:param value="{!w.NextActionDate}"/>
</apex:outputText>
</apex:column>
<apex:column headervalue="Due Date">
<apex:outputText value="{0,date,MM'/'dd'/'yyyy}" style="{!w.DueStyle}">
<apex:param value="{!w.DueDate}"/>
</apex:outputText>
</apex:column>
<apex:column headervalue="Type">
<apex:outputtext value="{!w.WorkItemType}"/>
</apex:column>
<apex:column headervalue="Work">
<apex:outputlink value="/{!w.WorkItemID}"/>
{!w.WorkItemName}
</apex:column>
</apex:pageblocktable>
</apex:pageblock>
</apex:form>
</apex:page>
Here is the html.
colspan="1"><a href="https://na14.salesforce.com/a0Kd00000036RrYEAU"></a>
Seattle P2 Audit</td>
and this link works if I copy and paste it into the browser (I’m using Firefox)
The VF page cell is just rendered as if it were just an outputtext field.
Any ideas?
- robertcw777
- April 01, 2013
- Like
- 0
- Continue reading or reply
Working Google Map Example?
I've done quite a bit of research on the forums on how to include a "simple" Google Map example, and have tried many of them. With all , I seem to end up in the same place as a lot of others end up based on the forum comments - the map never actually comes up. I have a valid API key that I substitute, and still nothing comes up - just a blank VF page. Does anyone have a real working example that I could review and modify?
I just want to display a set of locations on the map. In my case, location is a custom object with country, state,city and zip (not a standard account record). If I can just get something basic working (i.e. actually see a map), I can then modify it to also set the marker colors based on some properties of the location - it's for a dashboard.
Any help would be greatly appreciated (something in API V3 would be best, but at least an example that works). I thought this was going to be simple...
- robertcw777
- March 10, 2013
- Like
- 0
- Continue reading or reply
Close VisualForce Page and Refresh Detail Record Page
I want to open a visualforce page from a custom button on a custom object detail page. The user selects a value in a tree dispayed in a VF page, and then clicks on a save button. I would like to update a record on the custom object, close the VF page, and then refresh the detail page so the record updates (updating the field itself would be better).
I've tried all kinds of solutions for similar situations on the web, but can't get any to work. Does someone know how to do this?
Thanks!
Here is VF:
<apex:page id="CompetencyRolesPage" StandardController="Competency__c" Extensions="TestPageController">
<apex:form >
<apex:outputPanel rendered="{!validRoleID}">
<c:TreeView selectable="true" roleOrUserId="{!RoleID}" value="{!selectedValues}" />
<apex:commandButton value="Save" action="{!saveRole}" />
</apex:outputPanel>
</apex:form>
</apex:page>
Here arerelevant pieces from controller:
public String selectedValues {get; set;}
public String userRoleID {get;set;}
public Boolean getValidRoleID() {
If(null==UserInfo.getUserRoleID())
return false;
else
return true;
}
public String getRoleID() {
userRoleId=UserInfo.getUserRoleID();
return userRoleID;
}
public PageReference saveRole() {
//will update customer field in detail record here.
return null;
}
- robertcw777
- March 08, 2013
- Like
- 0
- Continue reading or reply
Fix Scale on Visualforce Chart
Is there any way to fix a scale and scale interval on a visualforce chart? I'm plotting a bar series that looks like:
x y
-30 1
-20 5
-10 8
+10 3
+20 4
+30 6
It anchors the vertical barchart y axis scale at 1 and the top at 9, therefore, there is no bar shown for the first point at x=-30. I guess in a series starting at x=0 you could add another element at 0,0, but that doesn't work here. I can' t see any way in the documentation to set the scale, I also have the case where they y-values need to be whole numbers, yet it shows the scale in increments of 0.5,
- robertcw777
- February 19, 2013
- Like
- 0
- Continue reading or reply
Display Child Records in Table
I have a custom object Parent__c and child records Child__c. I want to show fields from the child record that corresponds with its parent record. But, I want the titles for each child column to appear only at the top of the Visualforce table. Like:
Parent Field TItle Child Field 1 Title Child Field 2 Title Child Field 3 TItle
P1.Value P1.C1.Value P1.C1.Value P1.C1.Value
P1.C2.Value P1.C2.Value P1.C2.Value
P2.Value P2.C1.Value P2.C1.Value P2.C1.Value
P2.C2.Value P2.C2.Value P2.C2.Value
P2.C3.Value P2.C3.Value P2.C3.Value
etc.
Does anyone know how to do this?
Thanks!
- robertcw777
- January 24, 2013
- Like
- 0
- Continue reading or reply
Nested Pageblock Tables
I need to group and display child object fields by parent object fields in a nested VisualForce Pageblock. For example, Parent__c is the parent of Child__c. I'd like to display a table with the name of the parent in a row, and then show fields of Child__c for each name.
Parent Child
Name1 Field1
Field2
Field3
Name2 Field1
Field2
Field3
etc.
I know how to do the parent child query in the controller:
List <Parent__c> ParentChildList{get;set;}
Public LIst <Parent__c> getQueryList() {
ParentChildList = [Select Name,(Select Field1__c,Field2__c From Child__c) From Parent__c];
return ParentChildList;
}
I'm having trouble with the nested PageBlock tables in the VisualForce page (using apex:facet) that reference the data returned by the controller to show the nested table above. Help would be much appreciated.
- robertcw777
- January 10, 2013
- Like
- 0
- Continue reading or reply
New Custom Object from VisualForce Page
I have a custom object called Displine__c. I want to create a VF page that has a New button that will open the new record page for this object, and then rerender the page (there is a tableblock below that should be refreshed to show the new record). I couldn't find any way to do this. Help?
- robertcw777
- December 17, 2012
- Like
- 0
- Continue reading or reply