- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2016 01:18 AM
Hello,
Consider I have a list of questions. When I click on the first question, it should automatically take me to the bottom of the page.
window.scrollTo(0,document.body.scrollHeight); won't work as document won't work in API.
Thanks
Saranya
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2016 08:39 PM
Hello Mansoor,
I got the solution for the same.
$scope.scrollTo = function(id) {
var old = $location.hash();
$location.hash(id);
$anchorScroll();
//reset to old to keep any additional routing logic from kicking in
$location.hash(old);
};
<sp-model form-model="::data.sc_cat_item" mandatory="mandatory" ng-click="scrollTo('e30904d54f83e200bb603f828110c721')" ></sp-model>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2016 03:34 AM
If you need it on onchange of a variable try in that, else use that widget client controller.
Sample onchange script which I used.
$scope.$on("field.change", function(evt, parms){
if (parms.field.name == "field__name")
$rootScope.$broadcast("confItem.updated", parms.field.value);
});
-Mansoor
-Mark correct or helpful as applicable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2016 10:44 PM
Hello Mansoor,
Thanks for the reply.
Its not working for me .
In my catalog widget I have added like below.
HTML
<button id="button" name="submit" ng-disabled="submitted" ng-click="triggerOnSubmit()" ng-click="gotoBottom()"class="btn btn-primary">{{submitButtonMsg}}</button>
Client Script
$scope.gotoBottom = function() {
// set the location.hash to the id of
// the element you wish to scroll to.
$location.hash("button");//bottom is an element id
// call $anchorScroll()
$anchorScroll();
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2016 11:22 PM
Hello Mansoor,
I have tried the below HTML and widget client script added in my catalog item widget and while clicking it is working.On change of variable I need to scroll to the bottom of the page.Can you help me on this
<input type="button" value="Scroll to Bottom" ng-click="scrollToBottom()">
function ($scope, $http, spUtil, nowAttachmentHandler, $rootScope, $sanitize, $window, $sce,$location,$anchorScroll) {
$scope.scrollToBottom = function(){
// set id of element you want to scroll
$location.hash('button');
$anchorScroll();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2016 11:53 PM
Hi Saranya,
In the place of "$location.hash('button');" // button is a element id of an div in the bottom. for example "<div id = "button" > copyright </div>".
So please replace button by any element id which mentioned below in your widget, to get element id click F12 and in the Elements tab select bottom div like below.
Also for demo please try this link AngularJS - anchor Scroll.
-Mansoor
-Mark correct or helpful as applicable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2016 12:03 AM
Hello Mansoor,
This is working fine.It scrolling down to the bottom of page.
My record producer is below..Based on first question second question will populate.After clicking in the second question only page will become that is working fine now.
In the first question there I don't want this scroll now I need double click in the question.
Is there any way to add this scroll option on change of my variable in record producer catalog client script.so it will serve my purpose.