Click on one of rows and show detail view in modal or pop-up window for add/edit

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
D Campbell
Posts: 20
Joined: 2017-03-12 09:32

Click on one of rows and show detail view in modal or pop-up window for add/edit

Post by D Campbell » 2017-08-16 18:14

Looking for something like click on one of rows from the table and show detail view in modal or pop-up window for add/edit info then save it, return to table?

R Tammam
Veteran Member
Posts: 113
Joined: 2017-08-26 15:35

Re: Click on one of rows and show detail view in modal or pop-up window for add/edit

Post by R Tammam » 2018-01-08 17:28

Hello D Campbell,

you can do it by adjusting the behavior of td on clicking on it

first you will insert your code in tablename-tv.js you will create this file in the hooks folder

then you will need some code like that


$j(function(){

//catch the behavior of clicking on any td , prevent it's defulat , the preventDefault dosn't work try to test it and then put your modal of pop up code in the file
$j("td a").click(function(event){

event.preventDefault();


//put your modal or popup behaviour here

})

})

The idea that in normal behavior on clicking on any record it submits a form and open a form for editing , we will jsut change it's behviour to be open in modal or pop up

hope it will help you

Regards,
Reham

User avatar
ronwill
Veteran Member
Posts: 228
Joined: 2015-08-08 10:12
Location: Cheltenham UK +Weatherford USA

Re: Click on one of rows and show detail view in modal or pop-up window for add/edit

Post by ronwill » 2020-09-07 09:06

Any chance anyone can give an example of the code to use for this?

I would like to open detailed.dv views in a modal when selected from table.tv table. Tried to figure it out but no success yet!

Cheers, Ron
Ron - Gloucestershire, UK: AppGini Pro V 23.15 Rev 1484 - LOVING IT!
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course

User avatar
ronwill
Veteran Member
Posts: 228
Joined: 2015-08-08 10:12
Location: Cheltenham UK +Weatherford USA

Re: Click on one of rows and show detail view in modal or pop-up window for add/edit

Post by ronwill » 2020-09-10 16:24

I have found a work around for the moment (requires changes to template.tv) but still hope someone can provide a quicker code solution!.

For the required popup modal I do not need add/edit functions to the modal template.dv - I just want it to open as modal instead of separate template.dv page for showing information

Cheers, Ron
Ron - Gloucestershire, UK: AppGini Pro V 23.15 Rev 1484 - LOVING IT!
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: Click on one of rows and show detail view in modal or pop-up window for add/edit

Post by a.gneady » 2021-02-05 20:28

I know this is a very late reply, but better late than never :roll:

Here is a fix that doesn't involve modifying generated files -- you should add the following code to hooks/footer-extras.php if you want to apply it to all tables, or to hooks/tablename-tv.js if you want to apply it only to a specific table:

Code: Select all

<script>
$j(function() {
   $j('td > a').attr('onclick', '').click(function(e) {
      e.preventDefault();
      var link = $j(this).attr('href') + '&Embedded=1'; // add '&dvprint_x=1' to show non-editable DV
      modal_window({
         url: link,
         size: 'full',
         noAnimation: true,
         title: 'Detail view', /* change that to the desired modal window title */
         close: function() {
            if(confirm('Would you like to reload the table to see changes made in the record?')) location.reload();
         }
      });
   })
})</script>
If you're placing the above code in hooks/tablename-tv.js, please remove the <script> and the </script> lines.
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

Post Reply