Welcome Guest, Not a member yet? Register   Sign In
Performance Question: jQuery Modal Dialog
#2

[eluser]Samus[/eluser]
[quote author="kingmaoam" date="1345470101"]Hi,
The dialog window is only working for the first entry... seems not to get more then one id='confirm_link'...

Now my idea would be to dynamically generate the jQuery Code and id attributes with something like id='confirm_link_'.$entryID but I think this could be very inperformant in large lists having a lot of jQuery Code generated and rendered...

Is there a better, more performant approach I could use?

KR
Habib[/quote]
#1 because it's an 'ID'. Meaning it should only be able to be identified by one element, so jquery will pick either the first matching ID or the last (not too sure).

You're going about it in the right way and I don't think there will be any performance issues.

Only thing i'd suggest is you place your code all within your click() event to ensure that code is actually only being run when someone actually goes to click to delete.

e.g

Code:
<.script type="text/javascript">

$(document).ready(function() {

$('a.confirm_link').click(function() {
var targetUrl = $(this).attr("href");
var ID = $(this).attr("id");
  $dialog.dialog('open');
  // prevent the default action, e.g., following a link
  return false;
});

var $dialog = $('<div></div>')
.html('Wollen Sie den Einsatz wirklich löschen?')
  .dialog({
   autoOpen: false,
   title: 'Einsatz löschen',
   width: '600px',
   modal: true,
   buttons: {
    "Löschen": function() {
             [removed].href = targetUrl
    },
    "Zurück": function() {
     $( this ).dialog( "close" );
    }
   }
  });

});
</.script>

Also don't select a specific ID. Select an element and grab it's ID how i've done above.


Messages In This Thread
Performance Question: jQuery Modal Dialog - by El Forum - 08-20-2012, 06:41 AM
Performance Question: jQuery Modal Dialog - by El Forum - 08-20-2012, 07:05 AM
Performance Question: jQuery Modal Dialog - by El Forum - 08-20-2012, 07:43 AM
Performance Question: jQuery Modal Dialog - by El Forum - 08-20-2012, 08:12 AM
Performance Question: jQuery Modal Dialog - by El Forum - 08-20-2012, 08:25 AM
Performance Question: jQuery Modal Dialog - by El Forum - 08-20-2012, 08:47 AM
Performance Question: jQuery Modal Dialog - by El Forum - 08-22-2012, 05:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB