Page 1 of 1

How to link to a location on a page?

Posted: Mon May 12, 2014 4:53 am
by bahar.wadia

Is there a way to jump a specific location on a page.

For example, if I have a list of 100 items and only 4 or 5 items show up ion the screen (screen size limitations) can I provide an Anchor similar to HTML so that the user jump to item number 50 (or whatever).

Thanks for your help.


How to link to a location on a page?

Posted: Mon May 12, 2014 6:03 am
by Kateryna Grynko

Hi Bahar,

There are two ways to do this:
1) Add Link component with relative path to listitem.
2) Dynamically create inner URLs using append function.


How to link to a location on a page?

Posted: Mon May 12, 2014 10:54 am
by bahar.wadia

I understand what you are saying, but have no idea how to do either. Can you please provide me with an example. Thx


How to link to a location on a page?

Posted: Tue May 13, 2014 3:24 am
by Yurii Orishchuk

http://appery.io/app/view/3aba3058-a6...=

Hi Bahar.

Please try this solution:

1 In link from "array" to "listItem" click "AddJS/EditJS" and fill it with following code: http://prntscr.com/3iqrrz/direct

pre
code

jQuery(element).addClass("yourListItem_id" + value.id);

/code
/pre

2 Create JS event handler for "success" event on your list service with following code:

pre
code

var listItemId = /yourListItem=([\?\#]+)/gi.exec(window.location.search)[1];

var activeItem = jQuery(".yourListItem_id_" + listItemId)

if(activeItem[0])
activeItem[0].scrollIntoView();

/code
/pre

That's all.

From this time you can use links like:

http://appery.io/app/view/3aba3058-a6...

where: "534c7e16e4b02ae4f9496fc1" - is id of your list item. Got from "_id" collection attribute.

Regards.