Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

float type #81

Open
redrobotdev opened this issue Aug 30, 2017 · 3 comments
Open

float type #81

redrobotdev opened this issue Aug 30, 2017 · 3 comments

Comments

@redrobotdev
Copy link

with current implementation you cannot save the value as float

@JackAdams
Copy link
Owner

Yes, that's right. It's not something I've ever needed, so I haven't implemented it.

The code base is a bit messy but if you want to do a PR I'll happily accept it.

@redrobotdev
Copy link
Author

redrobotdev commented Aug 30, 2017

I can take a look at it at spare time. Though a quick solution would be to use beforeInsert callback and convert from string to float correct? I haven't been able to get the callback to trigger.

in the blaze template:

{{> editableText context=.. collection="AudioFiles field=(freq @index) acceptEmpty=true unsetEmpty=true **beforeInsert="convertToFloat"** substitute='<i class="fa fa-pencil"></i>'}}

In the template .js controller

EditableText.registerCallbacks({
    convertToFloat : function (documentToBeInserted, Collectiondoc) {
        console.log("convert to float");
        return true;
    },
});

@JackAdams
Copy link
Owner

JackAdams commented Aug 30, 2017

Yes, that would work, but use beforeUpdate rather than beforeInsert. (The widget only inserts a whole document if it has autoInsert=true set and a context that doesn't contain an _id value. Otherwise it just updates the particular field value.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants