question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How Can I use the Bootstrap Modal in bootgrid Command button

See original GitHub issue

I am trying open bootstrap modal in command edit and delete button.

command button

It doesn’t work data-toggle="modal" data-target="#confirmation"

Here my jQuery Code $( document ).ready(function() { $(“#grid-plant”).bootgrid({ caseSensitive: false, columnSelection: false,

        formatters: {
            "commands": function (column, row) {
                return "<button type=\"button\" class=\"btn btn-xs btn-default command-edit\"  data-toggle=\"modal\" data-target=\"#confirmation\"><span class=\"fa fa-pencil\"></span></button> " +
                    "<button type=\"button\" class=\"btn btn-xs btn-default command-delete\" ><span class=\"fa fa-trash-o\"></span></button>";
            }
        }
    })
    });

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
juanvilucommented, Oct 25, 2016

.on("loaded.rs.jquery.bootgrid", function(){ grid .find(".command-edit") .on("click", function(e) { console.log( e.currentTarget ); $($(e.currentTarget).attr("data-target")).modal("show"); })

1reaction
jeysinghanbucommented, Jun 16, 2015

Finally Got 😃 it is working.

Opening Bootstrap Modal on Click Event.

         .on("loaded.rs.jquery.bootgrid", function () {
         /* Executes after data is loaded and rendered */
         $(this).find(".command-delete").click(function (e) {
        $($(this).attr("data-target")).modal("show");
    });
});

Full jQuery Code Here:

        $( document ).ready(function() {
        $("#grid-plant").bootgrid({
        caseSensitive: false,
        columnSelection: false,

        formatters: {
            "commands": function (column, row) {
                return "<button type=\"button\" class=\"btn btn-xs btn-default command-edit\"  data-toggle=\"modal\" data-target=\"#confirmation\"><span class=\"fa fa-pencil\"></span></button> " +
                    "<button type=\"button\" class=\"btn btn-xs btn-default command-delete\" ><span class=\"fa fa-trash-o\"></span></button>";
            }
        }
    }).on("loaded.rs.jquery.bootgrid", function () {
        /* Executes after data is loaded and rendered */
        $(this).find(".command-delete").click(function (e) {
            $($(this).attr("data-target")).modal("show");
        });
    });
    });
Read more comments on GitHub >

github_iconTop Results From Across the Web

jQuery-bootgrid modal dialog - Stack Overflow
Opening Modal on click Event Reference formatters: { "commands": function (column, row) { return "<button type=\"button\" class=\"btn btn-xs ...
Read more >
Modal - Bootstrap
Use Bootstrap's JavaScript modal plugin to add dialogs to your site for lightboxes, user notifications, or completely custom content.
Read more >
Opening Bootstrap modal from URL in grid column - Telerik
I would like to show a clickable URL within a Kendo Grid that opens a bootstrap modal. Unfortunately, when the user clicks on...
Read more >
Bootstrap 4 Modal with Grid System - CodePen
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#grid"> ... <div class="modal fade" id="grid" tabindex="-1" role="dialog" ...
Read more >
Bootstrap JS Modal Reference - W3Schools
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found