Search code examples
javascriptnode.jseventssails.jsmarionette

working with events in sails js


I´m trying to create an event that when pussing a button in the .ejs file the color of some datetable column changes. The thing is that I´m not able to get into that function... I guess the code is not correct. Any clue?

Result.ejs

<div class="btn-group pull-right">
    <button id="cancelButton" class="btn btn-sm btn-round btn-danger" style="margin-right:5px"><i class="ace-icon fa fa-stop"></i>Cancelar</button>
</div>

list_view.js

List.Layout = Marionette.LayoutView.extend({
    template: "#resultadomonitorizacion-list-layout",
    events: {
        "submit #btn-group pull-right #cancelButton": "cancelarMonitorizacion"
    },

    ui: {
        datatable: "#datatable",
        inputSearch: ".dataTables_filter input"
    },

    cancelarMonitorizacion: function (e) {
        console.log("hello")
    },

Solution

  • DONE!!! It was a marionette and jquery selectors problem

    http://www.w3schools.com/jquery/jquery_ref_selectors.asp

    events: {
            "click #cancelButton": "cancelarMonitorizacion"
        },