Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 128
  • Last Modified:

Bootstrap

Hi Guys,

I created bootstrap modal popup box in my MVC application and I can't do couple of things with it
1. I can't add minimize button.
2. I can't drag the popup window.

Actually, I'm looking for to how I can add property to this modal box. I found this on the internet but still didn't get it and also it doesn't have all the properties I need - https://nakupanda.github.io/bootstrap3-dialog/.
I was trying to do some javascript as well but no success.

Here is my code:
Please, let me know if you have any idea to how can I get properties for modal box.
<div class="form-group">
    <div class="text-center">
        <h2>Bootstrap Modal</h2>

    </div>
</div>

<div class="form-group">
    <div class="col-md-12">
        <div class="modal fade" id="myModal" role="dialog">
            <div class="modal-dialog">
                <!-- Modal content-->
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h4 class="modal-title">Modal Header</h4>
                    </div>
                    <div class="modal-body">
                        <p>Some text in the modal.</p>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
<br />

<button class="btn btn-default" data-toggle="modal" data-target="#myModal">Open Modal</button>


@section scripts{
    <script>
       
      

    </script>
}

Open in new window

0
Moti Mashiah
Asked:
Moti Mashiah
  • 3
  • 2
1 Solution
 
Marco GasiFreelancerCommented:
let me know if you have any idea to how can I get properties for modal box.
What do you mean saying 'properties'?
About minimize button it doesn't make sense to me: desktop applications dialogs don't have a minimize button and I don't understand why you should put a minimize button in a dialog. A dialog is a quick message to the user, a quick question, sometime a simple form: all things which don't have to be minimized because they prevent the app to work until the user press OK or Cancel buttons...
0
 
Moti Mashiah.NET DeveloperAuthor Commented:
Actually, I'm using dialog for more than just popup messages as I'm using asp.net mvc project and my dialogs are using for search boxes and yes there is minimize option for dialog boxes.

Sorry, I think I wasn't clear enough when I post the question.

Now before I explain what I really need please visit this link - https://github.com/ROMB/jquery-dialogextend and see example:

This link above gives the option to do it but for some reason I can't get it to how to make it work in my MVC project.

Here is what I'm doing:
using framework - jquery-ui.js, jquery.dialogextend.js, jquery-ui.css

Html side:
<div id="popdialog">

</div>

Open in new window

javascript:
 $("#popdialog").dialog({
                title: "Dialog",
                autoOpen: false,
                width: 400,
                height: 400,
                resizable: true,
                draggable: true,
                minimize: "ui-icon-extlink",
            });

//here I click on button to initiate the dialog
[code]
 function Opendialog() {
            $("#popdialog").dialog('open');
        }

Open in new window



Please, let me know if you got my point this time.

Thanks,
0
 
lenamtlCommented:
Hi,

You are using an old code that is compatible with
jQuery 1.11.1
jQueryUI 1.11.0

So if you use more recent version of jQuery & jQueryUI, good chance the problem is coming from compatibility. If it's the case you can try to use https://github.com/jquery/jquery-migrate

What was missing from the Bootstrap modal so I can suggest you a better script.
http://getbootstrap.com/javascript/#modals
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Moti Mashiah.NET DeveloperAuthor Commented:
Actually, there is no compatibility issues in my case.

I just need to know how to write the properties right.

For example:
$("#popdialog").dialog({
                title: "Dialog",
                autoOpen: false,
                width: 400,
                height: 400,
                resizable: true,
                draggable: true,
                minimizeable: [true,{ my: "ui-icon ui-icon-minus" }],\\ How can I write this line to work.
            });

Open in new window

0
 
lenamtlCommented:
Hi,

The close function seems missing from your script

"close" : function(){
        if(last[0] != this){
          $(this).remove(); 
        }

Open in new window


Also check the dialog-extend options
This is a working example
$(function(){
  var last;

  // preview icon
  $("#config-icon select")
    .change(function(){
      var icon = "<span class='ui-icon "+$(this).val()+"'></span>";
      $(this).parents(".wrapper").find("ins").html(icon);
    })
    .trigger("change");


  // click to open dialog
  $("#new-dialog").click(function(){
    //dialog options
    var dialogOptions = {
      "title" : "dialog@" + new Date().getTime(),
      "width" : 400,
      "height" : 300,
      "modal" : $("#is-modal").is(":checked"),
      "resizable" : $("#is-resizable").is(":checked"),
      "draggable" : $("#is-draggable").is(":checked"),
      "close" : function(){
        if(last[0] != this){
          $(this).remove(); 
        }
      }
    };
    if ( $("#button-cancel").is(":checked") ) {
      dialogOptions.buttons = { "Cancel" : function(){ $(this).dialog("close"); } };
    }
    // dialog-extend options
    var dialogExtendOptions = {
      "closable" : $("#button-close").is(":checked"),
      "maximizable" : $("#button-maximize").is(":checked"),
      "minimizable" : $("#button-minimize").is(":checked"),
      "minimizeLocation" : $("#my-form [name=minimizeLocation]:checked").val() || false,
      "collapsable" : $("#button-collapse").is(":checked"),
      "dblclick" : $("#my-form [name=dblclick]:checked").val() || false,
      "titlebar" : $("#my-form [name=titlebar]:checked").val() || false
    };
    $("#my-form [name=icon]").each(function(){
      if ( $(this).find("option:selected").html() != "(default)" ) {
        dialogExtendOptions.icons = dialogExtendOptions.icons || {};
        dialogExtendOptions.icons[$(this).attr("rel")] = $(this).val();
      }
    });
    $("#my-form [name=event]").each(function(){
      if ( $(this).is(":checked") ) {
        dialogExtendOptions[$(this).attr("rel")] = function(evt, a,b,c) {
          $(evt.target).prepend(evt.type+"@"+evt.timeStamp+"<br />");
        };
      }
    });
    // open dialog
    last = $("<div />").dialog(dialogOptions).dialogExtend(dialogExtendOptions);
  });
  
  //click to reopen dialog
  $('#reopen-dialog').click(function(){
    last.dialog('open');
  });
  // click to invoke method
  $("#config-method button").click(function(){
    var command = $(this).text();
    var dialog = $(".ui-dialog:last").find(".ui-dialog-content");
    if ( $(dialog).length ) {
      if ( command == 'state' ) {
        alert( $(dialog).dialogExtend(command) );
      } else {
        $(dialog).dialogExtend(command);
      }
    }
  });

});
</script>

Open in new window

0
 
Moti Mashiah.NET DeveloperAuthor Commented:
partly solved but gave me the idea thx.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now