-
Notifications
You must be signed in to change notification settings - Fork 0
/
autonumeric.js
31 lines (29 loc) · 903 Bytes
/
autonumeric.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Template.autoNumeric.onRendered(function () {
var input = $(this.find('input')),
config = { // default config
aSep: ',',
dGroup: 3,
aDec: '.',
altDec: null,
aSign: '',
pSign: 'p',
vMin: '0.00',
vMax: '999999999.99',
mDec: null,
mRound: 'S',
aPad: true,
nBracket: null,
wEmpty: 'empty',
lZero: 'allow',
aForm: true
};
var settings = _.pick(this.data, _.keys(config));
_.defaults(settings, config);
input.autoNumeric('init', settings);
this.autorun(function () {
input.autoNumeric('set', Template.currentData().value)
});
});
Template.autoNumeric.onDestroyed(function () {
$(this.find('input')).autoNumeric('destroy');
});