Hi guys im getting an error 'Unknown property 'CAP_ManageDepartment.countriesOptions'' when im trying to use a method from the controller
Here is my method:
#RemoteAction global static List<String> getCountriesOptions(ccrz.cc_RemoteActionContext ctxpage) {
List<String> allCountriesList = new List<String>{' Afghanistan',' Albania',' Algeria'};
return allCountriesList;
}
and here is where im trying to get it:
<div class="form-group">
<div class="req_list_description">
<apex:selectList value="{!editCountry}" multiselect="false" size="1">
<apex:selectOptions value="{!countriesOptions}"/>
</apex:selectList>
</div>
</div>
Error: Unknown property 'CAP_ManageDepartment.countriesOptions'
what should i do ??
Related
I am working off of some code I found on the Internet - I have only been on the ADM 201 course.
What I am doing is attempting to pull the information from a post and then put this into a VF page. I know I can use chatter:feed, but this is getting all of the information and functions, whereas I need only the text body, poster name, and picture (not essential).
What I have so far:
Apex Class:
public class Test_3 { //Class is
public ConnectApi.FeedElementPage feedElementPage{get;set;}
public Test_3() {
feedElementPage = ConnectApi.ChatterFeeds.getFeedElementsFromFeed('0F958000000TWvL', ConnectApi.FeedType.Record, 'showInternalOnly');
}
}
VF page:
<apex:page controller="Test_5">
<div class="posts">
<div class="row">
<div class="col-md-6">
<apex:repeat value="{!feed.elements}" var="feedElement">
<div class="media">
<a class="pull-left" href="{!feedElement.parent.id}">
<img class="media-object" src="{!feedElement.photoUrl}" alt="{!feedElement.actor.name}"/>
</a>
<div class="media-body">
<h4 class="media-heading">{!feedItem.actor.name}</h4>
// This creates a heading from the posts that is the poster's name
{!feedElement.body.text}
// This is the body of the post
</div>
</div>
</apex:repeat>
</div>
</div>
</div>
<footer>
<p>© Operations Updates - Please refresh your browser for the latest</p>
</footer>
</apex:page>
Current issues:
!feedElement.parent.id
!feedItem.actor.name
"Error: Unknown property 'ConnectApi.Feed.elements'"
Anyway, I can't work this out. I've been trying to make this for a lovely 5 hours now.
Any help would be much appreciated.
The code was modified from here and then I attempted to update it to Elements from Items.
Thanks
In your Apex class, the variable is called "feedElementPage" but in the Visualforce page, it says "feed". Please update feedElementPage to feed in Apex class or update repeat value="{!feed.elements}" to repeat value="{!feedElementPage.elements}"
In addition, I think you should use FeedItem instead of FeedElement. Please take a look at the document, and let me know if you have any other questions.
I am trying to access an DOM element inside a dymanic loaded HTML with http get request. The code that I am using inside controller is
$http.get("/ProjectManager/Edit?id=" + requestId).success(function (data, status, headers, config) {
data = data.trim();
var newDirective = angular.element(data);
angular.element(document.getElementById("editDiv")).html(newDirective);
$compile(newDirective)($scope);
var resources = angular.element(document.getElementById("projectResources")).val();
for (var i = 0; i < resources.length; i++) {
var resourceData = new ProjectResourcesModel(resources[i].ResourceID, resources[i].ProjectResourceID, resources[i].Employee, resources[i].IsApprover, resources[i].StartDate,
resources[i].EndDate)
$scope.resource.push(resourceData);
//$scope.$apply();
var id = "startDate" + resources[i].ResourceID;
angular.element(document.getElementById(id)).datetimepicker({
defaultDate: resources[i].StartDate,
format: 'MM/DD/YYYY',
})
}
})
I am trying to access a element with particular id that is present in my array element.
View HTML inside a ng-repeat is as follows
<div>
<div class="form-group">
<div class='input-group date' id='startDate{{item.ResourceID}}'>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
<input ng-model="item.StartDate" type='text' id="txtStartDate{{item.ResourceID}}" class="form-control" />
</div>
</div>
</div>
</div>
I have to attach bootstrap datetimepicker to a textbox so I want to access a div inside ng-repeat whose ID is present inside by ng-repeat array.
But when I access the item with that id inside success of get request I am not getting the element. for e.g id of div would be startDate151 after the view binding.
So I tried using $scope.$apply() with which I am able attach the datepicker to element inside ng-repeat but I started getting a console error
Error: [$rootScope:inprog] $digest already in progress
Can anyone help me to resolve this or can I use some other alternative in this situation.
Once user select value from tree dropdown I want to call service for tool-tip associated with label to show description of the selected text in the input field. How can i achieve the task using AngularJS tool-tip feature and get the description. I am new to AngularJS any detail help will be appreciated.
So far tried Code..
Ctrl.js
<div class="form-group col-md-6 fieldHeight">
<label for="erh" class="col-md-5 required">Enterprise Reporting Hierarchy:
<span ng-mouseover="tooltip={{erhHirachyInfo.erhToolTip}}"
class="glyphicon glyphicon-info-sign pull-right"></span>
</label>
<div class="col-md-7">
<div multiselect-dropdown-tree ng-model="nonPersistentProcess.erhKey"
options="erhTreeviewOptions">
</div>
</div>
service.js
return $resource('app/prcs/rest/process/getERhHirachyInfo/:id', {}, {
'query': {
method: 'GET'
},
'get': {
method: 'GET'
}
});
The Angular team developped a directive for this purpose:
https://angular-ui.github.io/bootstrap/#/tooltip
http://getbootstrap.com/javascript/#tooltips
I currently have a static slider implemented in a partial view under the shared folder:
#{
ViewBag.Title = "_SliderPartial";
}
#*slider*#
<div id="myCarousel" class="carousel slide">
<!-- Carousel items -->
<div class="carousel-inner">
<div class="active item">
<img src="~/Content/images/ads/banner1.jpg" />
</div>
<div class="item">
<img src="~/Content/images/ads/banner2.jpg" />
</div>
<div class="item">
<img src="~/Content/images/ads/banner3.jpg" />
</div>
<div class="item">
<img src="~/Content/images/ads/banner4.jpg" />
</div>
</div>
<!-- Carousel nav -> toont navigatie pijlen op slider-->
#* <a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>*#
</div>
I render this view in the _BootstrapLayoutcshtml which can be found in
following pastebin: http://pastebin.com/AvxMeVQS (line 100) and it works perfectly fine.
My problem is that I want the slider to be dynamically filled with images stored in
the ads folder based on certain parameters (I only want to displays ads that are active,
they all have a start and end date, stored in a database). I know how to code this
but the issue is that I don't have any controller (because shared doesn`t need one I guess?) to gather the ads and send them.
I would be amazing if somebody could help me because I am fairly new to MVC, thanks in advance!
Solution explorer: http://i46.tinypic.com/2cwt02h.png
I did something similar, in order to follow a decent working practice you will need a Model and controller. You would probably want an Image view model for example (pseudo code below)
namespace Models
{
public class adsImage
{
public int ID {get; set;}
public string src {get; set;}
}
}
public class HomeController : Controller
{
public ActionResult RenderAds()
{
List<Models.adsImage> imgList = new List<adsImage>();
imgList.add(new adsImage({ src = ""});
return PartalView("YourPartialView",imgList);
}
}
}
Dont forget to bind model to view (add this to your partial view)
#model List
Last thing to do is render the partial view via your action method
#{ Html.RenderAction("RenderAds","Home"); }
I have a commandButton in a visualforce component. The expected behavior is that the controller method would be called. The page is refreshed, but the method registered in the commandButton {!performUnlinkContact} is not called. The strange thing is that if I put the button on the base visualforce page, it calls the controller method as expected - but when in a component, it does not.
Here is my component:
<apex:component >
<apex:attribute name="rk" description="RK Base Contact Data" type="Object" required="true"/>
<div class="unlinkBox">
<div class="unlinkHeader">
<div class="unlinkHeaderLeft">Wrong Contact?</div>
<div class="unlinkHeaderRight"><apex:image style="cursor: pointer;" value="{!$Resource.x}" alt="Close Panel" /></div>
</div>
<div class="unlinkBody">
<div class="unlinkBodyLeft">
Click Yes if the Contact displayed is incorrect.<br/><br/>You will be given the opportunity to link to a different Contact.
</div>
<div class="unlinkBodyRight">
<apex:outputpanel id="callMethod">
<apex:commandbutton value="Yes, this is the wrong contact" action="{!performUnlinkContact}" rerender="" status="myDisplayStatus" /> <a onclick="return hideUnlinkPanel()" style="color:blue;cursor:pointer;text-decoration:underline">No</a>
</apex:outputpanel>
<apex:actionStatus id="myDisplayStatus" startText="(performing Contact Unlink...)" stopText=""/>
</div>
</div>
</div>
</apex:component>
and here is the method in the controller extension:
public PageReference performUnlinkContact() {
System.debug('==================================!!performUnlink');
if (this.thisLead.rkContactId__c != 0) {
this.thisLead.rkContactId__c = 0;
update this.thisLead;
}
return null;
}
I'm sure I must be doing something wrong since I am new to salesforce and still learning, but I am unable to find any related issues when I search on how to resolve this issue. Thanks in advance for the help.
Thanks for the replies - to resolve I ended up adding an actionFunction to the base Page, then just calling this function in the component via a button's onclick event:
Code in base page:
<apex:actionFunction name="doUnlink" action="{!performUnlinkContact}" rerender="refresh" status="myStatus"/>
Code to call function in the component:
<input type="button" value="Yes, this is the wrong contact" onclick="doUnlink();" />
This method seems to work well so far.
You can also pass a reference of performUnlinkContact() to the component, using an apex:attribute of type ApexPages.Action, and then when your commandButton uses this reference, it will call the method defined in the page controller.
<apex:component>
<apex:attribute name="performUnlinkContact" type="ApexPages.Action" description="Passing method from controller"/>
<!-- your stuff here -->
</apex:component>
Then when you use your component, you have to populate that attribute like so:
<c:MyComponent performUnlinkContact="{!performUnlinkContact}"
I think rerender="" is not a way to do a fake reRender command. I would try it with rerender="none".