mardi 4 septembre 2018

How to create one class name in element while click on the table row

I need to include one class name inside the tag on clicking the corresponding row on the table. because I need to highlight the row while click on the corresponding row by using css. When I click on the row, its not showing any class name in the console. because of that I can't able to create the row highlight.

Here is the code I'm using:

        click: function () {
                var test = this.HeaderRowView.tableView.model;
                 $('.content-data').off('contextmenu');
                 $('.content-data').contextmenu(function(e){
                    if(e.which == 3){
                        var ibmm = this.hovered;
                        var model = Core.model.Menu.create({
                            loadState: 'done',
                            content: [
                                Core.model.Menu.Item.create({
                                    label: 'Delete IBMM Definition',
                                    icon: 'delete',
                                    invoke: function () {
                                        var fmtLabel = ibmm.label ? (ibmm.label + " ("+ibmm.name+")") : ibmm.name;
                                        Core.confirm(
                                            "Delete IBMM Definition",
                                            "Are you sure you want to delete the IBMM Definition for " + fmtLabel + "?",
                                            "Delete",
                                            "Cancel"
                                        ).then(function () {
                                            Core.services({
                                                service: 'ibmm',
                                                type: 'delete',
                                                data: {
                                                    name: ibmm.name
                                                }
                                            }).done(function () {
                                                test.reload();
                                                Core.notify({
                                                    title:"Delete IBMM Definition",
                                                    message: "IBMM Definition " + fmtLabel + " deleted"
                                                });
                                            });
                                        });
                                    }
                                })
                            ]
                        });
                        var view = Core.view.Menu.create({
                            model: model,
                            menuContext: { ibmm: ibmm },
                        });
                        document.styleSheets[1].cssRules["1538"].style.display ="none"
                        view.show();
                        Ember.run.next(view, (function () {
                            var X = e.clientX;
                            var Y = e.clientY;
                            if(document.getElementsByClassName('context-menu-items')[0]) {
                                document.getElementsByClassName('context-menu-items')[0].style.left = X+'px';
                                document.getElementsByClassName('context-menu-items')[0].style.top = Y+'px';
                                document.styleSheets[1].cssRules["1538"].style.display =""
                                document.getElementsByClassName('context-menu-items')[0].style.display = "block"
                            } else {
                                view.remove()
                                document.styleSheets[1].cssRules["1538"].style.display =""
                                return false;
                            }
                        }).bind(this));
                        return false;
                    }
                    }.bind(this))
            }

Here is the click option with the corresponding service code's. Please suggest me code from this. thanks in advance.




Aucun commentaire:

Enregistrer un commentaire