longshotlabs / meteor-delete-button Goto Github PK
View Code? Open in Web Editor NEWProvides a delete button UI component for Meteor apps
License: MIT License
Provides a delete button UI component for Meteor apps
License: MIT License
Hi,
I'm using this package to remove objects from my collection "projects".
I have added the button like this :
{{#quickRemoveButton collection="Projects" _id=this._id onError=onError onSuccess=onSuccess beforeRemove=beforeRemove class="btn btn-xs btn-danger"}}
{{/quickRemoveButton}}
I have also authorized the remove function :
if (Meteor.isServer) {
Projects.allow({
remove: function (userId, doc) {
return true;
}
});
The project is deleted but it throws this exception :
Exception in delivering result of invoking '/projects/remove': ["click button"]/<.remove/<@http://meteor-128110.nitrousapp.com:3000/packages/aldeed_delete-button.js?5374a4599af02af385dd7a72d89f3c1f5fe70deb:118:13
Mongo.Collection.prototype[name]/wrappedCallback@http://meteor-128110.nitrousapp.com:3000/packages/mongo.js?3cfe0c5981c197df33036a37574850f057e934a6:621:9
Meteor.bindEnvironment/<@http://meteor-128110.nitrousapp.com:3000/packages/meteor.js?43b7958c1598803e94014f27f5f622b0bddc0aaf:983:17
._maybeInvokeCallback@http://meteor-128110.nitrousapp.com:3000/packages/ddp.js?d1840d3ba04c65ffade261f362e26699b7509706:3860:7
.dataVisible@http://meteor-128110.nitrousapp.com:3000/packages
Any idea ?
Thanks for your help
Ohi,
There is a fork around with the described abilities: https://github.com/rafaelcorreiapoli/meteor-delete-button/commit/01001aa1dae0d7d6673dbb06cf2ca0b1c75d0b1c
Could you please pull this feature in?
Hi,
Not sure why this is happening, don't see any errors in the console. I have:
{{> quickRemoveButton beforeRemove=removeConfirm collection="Meteor.users" _id=this._id class="btn btn-danger"}}and the following helper function:
Template.Users.helpers({
data: function() {
return Meteor.users.find();
},
removeConfirm: function() {
return function(collection, id) {
console.log("beforeremove");
var doc = collection.findOne(id);
if (confirm('Really delete user: "' + doc.name + '"?')) {
this.remove();
Router.go('users');
}
};
}
});
but the removeConfirm method is never called and I'm unable to see why its not being called.
Any suggestions?
Thanks,
Mark
The delete button works great with
Benchmarks = new Mongo.Collection('benchmarks', {idGeneration: 'STRING'});
Whenever I click the delete button, the associate data is deleted as expected, and the table will refresh reactively.
But if I have
Benchmarks = new Mongo.Collection('benchmarks', {idGeneration: 'MONGO'});
Whenever I click the delete button, the data is deleted since I got result 1 from on success hook. But the data won't disappear. and the table will not refresh itself. After I refresh the page manually, the deleted data will disappear.
Does it have option to use zimme:collection-softremovable instead of deleting?
So it can be styled with bootstrap classes, for example.
Hi,
Any way to do it not to look like a button? I would like it to show up just like an icon from an icon font :)
Thanks!
How can we use this package to delete all children documents when a parent gets deleted.
I'm using tabular and a template for a column that displays actions buttons:
Tabular is initialized with the last column as a template:
{
tmpl: Meteor.isClient && Template.actionCell,
sWidth: "20px",
sClass: "td-center",
}
Template is something like this:
<template name="actionCell">
<div class="btn-group" role="group">
<button id="{{this._id}}" type="button" class="btn btn-xs btn-primary" data-toggle="modal" data-target="#editEntryDialog"><i class="fa fa-edit"></i>
</button>
{{# quickRemoveButton collection="MyCollection" _id=this._id onError=onError onSuccess=onSuccess beforeRemove=beforeRemove class="btn btn-xs btn-danger"}}
<i class="fa fa-trash"></i>
{{/quickRemoveButton}}
</div>
</template>
I wrote a simple helper to test the functionality:
Template.actionCell.helpers({
beforeRemove: function() {
alert('a dialog');
}
});
When the datatable loads, the alert dialog gets invoked. I think this is due the case that the content block is rendered and so the helper is being called.
Is it possible to use the template as a content block and make use of callbacks?
Note: I'm sorry for the editions, I had a lot of troubles with my touchpad.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.