Next and Previous Buttons

Put your suggestions here.
User avatar
elviseras
Investor
Investor
Posts: 578
Joined: 08 Feb 2017, 03:16
Name: Elvix Sampedro
Location: Galicia - Spain
Company Name: novaTEK

Next and Previous Buttons

Post by elviseras »

Hi,

Many times you need to see or even edit data from some records that are adjacent or nearby in lists... It would be very comfortable to have some buttons that allow you to go directly to the previous record and / or the next without leaving the window, in Page Info and in Edit Windows... (See attach images)
Instance_Info_Page.png
Instance_Data_Edit.png
I think it would be a simple modification and would also speed up the workflow and save a few mouse clicks

Regards,

elviseras
p.dimitrov
Posts: 166
Joined: 12 Jul 2017, 09:35
Name: Pavel
Location: Varna

Re: Next and Previous Buttons

Post by p.dimitrov »

I suggested that some time ago, but in the meantime I'm using 2 formula fields where I use CONCAT(id)-1 and CONCAT(id)+1 to get the previous and next id, then "assemble" the links in text pattern field and add some css to look like buttons. It's not very pretty but it works.
Untitled-1.jpg
User avatar
elviseras
Investor
Investor
Posts: 578
Joined: 08 Feb 2017, 03:16
Name: Elvix Sampedro
Location: Galicia - Spain
Company Name: novaTEK

Re: Next and Previous Buttons

Post by elviseras »

Wow!!! Fantastic solution !!!

Could you share in detail how you did it? I am not a programmer and I would be interested to apply it as a momentary solution

Thanks in advance!!
fahmisalim
Sponsor
Sponsor
Posts: 320
Joined: 12 May 2015, 08:33
Name: Fahmi Salim
Location: Indonesia BSD City
Company Name: AIMan
Contact:

Re: Next and Previous Buttons

Post by fahmisalim »

elviseras wrote: 16 Jul 2018, 15:49 Hi,

Many times you need to see or even edit data from some records that are adjacent or nearby in lists... It would be very comfortable to have some buttons that allow you to go directly to the previous record and / or the next without leaving the window, in Page Info and in Edit Windows... (See attach images)

Instance_Info_Page.png
Instance_Data_Edit.png

I think it would be a simple modification and would also speed up the workflow and save a few mouse clicks

Regards,

elviseras
Wow I meed this also in 2.7
Benno812
Posts: 133
Joined: 30 Oct 2019, 02:38
Name: Benedetto Fiorentini
Location: Rome, Italy

Re: Next and Previous Buttons

Post by Benno812 »

That would be very useful!
User avatar
elviseras
Investor
Investor
Posts: 578
Joined: 08 Feb 2017, 03:16
Name: Elvix Sampedro
Location: Galicia - Spain
Company Name: novaTEK

Re: Next and Previous Buttons

Post by elviseras »

Hi Pavel!! from Spain we hope it's all okay in Varna ...

For an ongoing project with a client, I would now need to be able to implement "Next" and "Previous" buttons like the ones you have created ... Could you tell me in more detail how to do it?

Thanks in advance
p.dimitrov
Posts: 166
Joined: 12 Jul 2017, 09:35
Name: Pavel
Location: Varna

Re: Next and Previous Buttons

Post by p.dimitrov »

Greetings, as I said I use 3 fields:
1 formula to calculate previous record id: [id]-1
1 formula to calculate next record id: [id]+1
1 text pattern field which is:

Code: Select all

<a class="btn btn-primary" href="http://your site goes here/index.php?module=items/info&path=[entity-id]-[prev-record-id]"><i class="fa fa-arrow-circle-left"></i></а>  <a class="btn btn-primary" style="float:right" href="http://your site goes here/index.php?module=items/info&path=[entity-id]-[next-record-id]"><i class="fa fa-arrow-circle-right"></i></а>
This html renders as two buttons with arrows aligned in left and right and uses the ids calculated in the formula fields.
There you also must find and put your entity URL, which always follows the following pattern:
http://your site goes here/index.php?module=items/info&path=[entity-id]-[record-id]
Mind that this solution only cycles to previous and next record, ignoring any filters or sorting.
User avatar
elviseras
Investor
Investor
Posts: 578
Joined: 08 Feb 2017, 03:16
Name: Elvix Sampedro
Location: Galicia - Spain
Company Name: novaTEK

Re: Next and Previous Buttons

Post by elviseras »

Thanks Pave!! It works as you say !!.
It is not ideal solution (hopefully Sergey can improve this need), but for now it is very useful!
You have some paid beers !!
regards
enishemed
Posts: 653
Joined: 30 Oct 2017, 11:24
Name: Enis Hemedoglu
Location: Istanbul, Turkey
Company Name: SCORE DANISMANLIK
Contact:

Re: Next and Previous Buttons

Post by enishemed »

I have something like that.

Use the code inside the "Php Code" section of Item Page Configuration. No need extra fields. But I could not put it to the right top of the page. That's why it is in the left bottom.

Code: Select all

$id = [id]; //id of current item
$id1 = $id - 1; //id of previous item
$id2 = $id + 1; //id of next item
$entity = 44; //id of entity
$website = "http://www.xxxx.com"; //your rukovoditel website
$path = "/index.php?module=items/info&path="; //path of item page

$link1 = $website . $path . $entity . "-" . $id1;
$link2 = $website . $path . $entity . "-" . $id2;

echo '<div align="left"><a class="btn btn-light" href="' . $link1 . ' "><i class="las la-angle-left"></i></a>';
echo '<a class="btn btn-light" href="' . $link2 . ' "><i class="las la-angle-right"></i></a></div>';
Attachments
2.png
1.png
User avatar
kubera
Posts: 94
Joined: 01 Feb 2018, 14:42
Name: kubera
Location: Poland

Re: Next and Previous Buttons

Post by kubera »

enishemed wrote: 19 Mar 2021, 18:32 I have something like that.

Use the code inside the "Php Code" section of Item Page Configuration. No need extra fields. But I could not put it to the right top of the page. That's why it is in the left bottom.

Code: Select all

$id = [id]; //id of current item
$id1 = $id - 1; //id of previous item
$id2 = $id + 1; //id of next item
$entity = 44; //id of entity
$website = "http://www.xxxx.com"; //your rukovoditel website
$path = "/index.php?module=items/info&path="; //path of item page

$link1 = $website . $path . $entity . "-" . $id1;
$link2 = $website . $path . $entity . "-" . $id2;

echo '<div align="left"><a class="btn btn-light" href="' . $link1 . ' "><i class="las la-angle-left"></i></a>';
echo '<a class="btn btn-light" href="' . $link2 . ' "><i class="las la-angle-right"></i></a></div>';
I made some changes in this code to show buttons in navbar :)
navbar.jpg
navbar.jpg (11.19 KiB) Viewed 1255 times
PHP Code

Code: Select all

$id = [id]; //id of current item
if ($id>1) {
	$id1 = $id - 1; //id of previous item
}
$id2 = $id + 1; //id of next item
$entity = 21; //id of entity 
//better use $current_entity_id

$website = "http://YOUR_WEBSITE"; //your rukovoditel website
$path = "/index.php?module=items/info&path="; //path of item page

$link1 = $website . $path . $current_entity_id . "-" . $id1;
$link2 = $website . $path . $current_entity_id . "-" . $id2;


//added id="btns" 
echo '<div id="btns" align="right">';
if ($id>1) {  //don`t show "Prev button" in first record
	echo '<a class="btn btn-primary" href="' . $link1 . ' "><i class="las la-angle-left"></i></a>';
}
echo '<a class="btn btn-primary" href="' . $link2 . ' "><i class="las la-angle-right"></i></a></div>';

JS Code

Code: Select all

jQuery(document).ready(function($){
	$("#btns").appendTo($(".navbar-ex1-collapse"));
});
Post Reply