Reverse scroll of deck and table components???

  • 1
  • Question
  • Updated 1 year ago
  • Answered
This is a question and an idea. I have need for a reverse scrolling feature in the deck component in unified builder. Picture the text messaging apps that anchor the most recent record at the bottom and you scroll up instead of down. Has anyone done this? Also, I would like to include it as an idea for development, though there are probably limited use cases, so I doubt it will make the priority list. You may find more people (like me) making more mobile friendly apps that may utilize this function more now that there is the Scale to mobile option which I really love.
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb

Posted 1 year ago

  • 1
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 11,050 Points 10k badge 2x thumb
Hi Raymond, I was imagining using the sort option for the Deck's model, but perhaps you've got something more nuanced in mind than sorting your records in ascending or descending order. Sorting on the model-level needs to use a real field, because it's actually part of the SOQL query sent to Salesforce, so we can't use {{index}} which is the way to refer to a row's number with merge-syntax.

Here is an inline Javascript method for scrolling your page to the bottom on page-load. If you add this to your page (not as a snippet, but as an inline resource), it should scroll to the X and Y coordinates you specify in the parentheses. The number 10000 is arbitrary, so if your page is longer you may need to make this number larger. 

(function(skuid){
var $ = skuid.$;
$(".nx-page").one("pageload", function(){
        window.scrollTo(0, 10000);
});
})(skuid);
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Interesting... I'll give it a try and report back! Thanks, Mark!