vendredi 7 septembre 2018

Click inside click option making difficult in my code

I had created the background color as yellow while selecting the gear icon for the menu option as delete in the table row, I have tried the below code for highlighting the table row,

            click: function () {
                        var ibmm = this.get('parentView.rowView.object');
                        var ibmms = this.get('parentView.rowView.tableView.model');
                        $(function() {
                              $("table.content-table.highlighted tr.content-row").on("focusout", function() {
                                  $(this).toggleClass("my-line");
                              });
                            });
                        var model = Core.model.Menu.create({
                            loadState: 'done',
                            content: [
                                Core.model.Menu.Item.create({
                                    label: 'Delete',
                                    icon: 'delete',
                                    invoke: function () {
                                        var fmtLabel = ibmm.label ? (ibmm.label + " ("+ibmm.name+")") : ibmm.name;
                                            Core.confirm(
                                                "Delete Definition",
                                                "Are you sure you want to delete the Definition for " + fmtLabel + "?",
                                                "Delete",
                                                "Cancel"
                                            ).then(function () {
                                                Core.services({
                                                    service: 'ibmm',
                                                    type: 'delete',
                                                    data: {
                                                        name: ibmm.name
                                                    }
                                                }).done(function () {
                                                    ibmms.reload();
                                                    Core.notify({
                                                        title:"Delete LMD Definition",
                                                        message: "LMD Definition " + fmtLabel + " deleted"
                                                    });
                                                });
                                            });

                                    }
                                })
                            ]
                        });
                        var view = Core.view.Menu.create({
                            model: model,
                            menuContext: { ibmm: ibmm },
                            anchor: this.$(),
                            highlight: this.$().parents('tr:first')
                        });
                        view.show();
                        return false;
                    }

Corresponding CSS I'm using as:

table.content-table.highlighted tr.content-row.my-line {
  background: #FFFF99 none 0 0 repeat;
}

While selecting the menu from the table row (hidden) with the gear icon, the background color is coming well by using the focusout function. But when I select the next table row with the gear icon, the background color is getting disappear. Because of main click function is going by using return. I'm having click function inside the click function. So only these problem occuring.

Please suggest me some suggestion on this. Thanks in advance




Aucun commentaire:

Enregistrer un commentaire