Reactive table: select multiple rows?


#1

Hi gurus, sorry for another dummy question, but I could not really find it on the forums…

  • How can I do a multiselect: Select mutiple rows (_ID’s) and then delete them all for example?

_ maybe with control click
_ maybe by dragging with the mouse?

thanks

this is the current code

Template.body.events({
    'click .reactive-table tbody tr': function(event) {
            var currentApp = this;
            console.log(event);

            if (event.target.className == "markAsTemplate") {
                console.log('markAsTemplate app clicked: ' + currentApp.name);
                TemplateApps.upsert(currentApp._id, {
                    $set: {
                        name: currentApp.name,
                        id: currentApp.id,
                        checked: !this.checked
                    },
                });
            }

            //Copy APP
            if (event.target.className === "copyApp") {
                console.log('Copy app clicked: ' + currentApp.name);

                Meteor.call('copyAppSelectedCustomers', currentApp, (error, result) => { //contains QVF guid of the current iteration over the apps  
                        if (error) {
                            sAlert.error(error);                            
                        } else {
                            sAlert.success("QVF '" + currentApp.name + " copied in Qlik Sense via the QRS API for each of the selected customers");
                            updateSenseInfo();
                        }
                    }) //method call 
            }

            //DELETE APP
            if (event.target.className === "deleteApp") {
                console.log('delete app clicked: ' + currentApp.name);
                Meteor.call('deleteApp', this.id, (error, result) => {
                        if (error) {
                            sAlert.error(error);
                            console.log(error);
                        } else {
                            console.log('app removed');
                            sAlert.success("APP " + currentApp.name + " deleted in Qlik Sense via the QRS API");
                            updateSenseInfo();

                        }
                    }) //method call 
            } //end if delete button is clicked 

#2

Maybe I am doing the old way, I am creating Multiple buttons per row. I think I should
Create separate buttons below the table: delete and copy

Make a mousedown event. And then highlight the selected rows. And while dragging it will fire the click event and I can make that Id selected:true I mongo