Next and Previous Buttons
- elviseras
- Investor
- Posts: 578
- Joined: 08 Feb 2017, 03:16
- Name: Elvix Sampedro
- Location: Galicia - Spain
- Company Name: novaTEK
Next and Previous Buttons
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)
I think it would be a simple modification and would also speed up the workflow and save a few mouse clicks
Regards,
elviseras
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)
I think it would be a simple modification and would also speed up the workflow and save a few mouse clicks
Regards,
elviseras
-
- Posts: 166
- Joined: 12 Jul 2017, 09:35
- Name: Pavel
- Location: Varna
Re: Next and Previous Buttons
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.
- elviseras
- Investor
- Posts: 578
- Joined: 08 Feb 2017, 03:16
- Name: Elvix Sampedro
- Location: Galicia - Spain
- Company Name: novaTEK
Re: Next and Previous Buttons
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!!
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!!
-
- 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
Wow I meed this also in 2.7elviseras 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
Re: Next and Previous Buttons
That would be very useful!
- elviseras
- Investor
- Posts: 578
- Joined: 08 Feb 2017, 03:16
- Name: Elvix Sampedro
- Location: Galicia - Spain
- Company Name: novaTEK
Re: Next and Previous Buttons
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
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
-
- Posts: 166
- Joined: 12 Jul 2017, 09:35
- Name: Pavel
- Location: Varna
Re: Next and Previous Buttons
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:
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.
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></а>
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.
- elviseras
- Investor
- Posts: 578
- Joined: 08 Feb 2017, 03:16
- Name: Elvix Sampedro
- Location: Galicia - Spain
- Company Name: novaTEK
Re: Next and Previous Buttons
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
It is not ideal solution (hopefully Sergey can improve this need), but for now it is very useful!
You have some paid beers !!
regards
-
- Posts: 653
- Joined: 30 Oct 2017, 11:24
- Name: Enis Hemedoglu
- Location: Istanbul, Turkey
- Company Name: SCORE DANISMANLIK
- Contact:
Re: Next and Previous Buttons
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.
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>';
Re: Next and Previous Buttons
I made some changes in this code to show buttons in navbar PHP Codeenishemed 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>';
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>';
Code: Select all
jQuery(document).ready(function($){
$("#btns").appendTo($(".navbar-ex1-collapse"));
});