Question

I have the following code, how can I open another page as modal window popup if row exist?

 function editLesson(){
            var row = $('#dg').datagrid('getSelected');
            if (row){
             // would like to open another page as modal window

            }
        }

Any help is highly appreciable.

Was it helpful?

Solution 2

You can use JQuery Dialog

as described here:

   <!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>jQuery UI Dialog - Default functionality</title>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css" />
  <script>
  $(function() {
    $( "#dialog" ).dialog();
  });
  </script>
</head>
<body>

<div id="dialog" title="Basic dialog">
  <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>


</body>
</html>

http://jqueryui.com/dialog/

OTHER TIPS

you could use fancybox plugin. it's a really great plugin. http://fancybox.net/ (mind fancybox 2 is out too)

http://jsfiddle.net/kasperfish/5EV8r/109/

$.fancybox('hello');

you also can load iframes in a fancybox (modal) window http://jsfiddle.net/kasperfish/5EV8r/110/

    $.fancybox([
        'url'//url to your page
    ], {

        'padding'           : 10,
        'type'              : 'iframe',//set type to iframe
        'overlayOpacity'    : 0.7,
        'overlayColor'      : 'black',
        'speedIn'           : 900,
        'speedOut'          : 400,
        'width'             : '70%',
        'height'            : '50%'

    });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top