Commit 362dd21c authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_produciton_planning: fix minor issue

no need to format
no need to bind other input
parent e111113b
var matrixbox;
var sRegExp = new RegExp('(-?[0-9]+)([0-9]{3})');
function format(num) {
// format a number to string, only 1 234 format is supported.
num = num.toString();
while(sRegExp.test(num)) {
num = num.replace(sRegExp, '$1 $2');
}
return num;
}
function parse(str) {
// parse a string to a number
// \s is for opera, others are for chrome / firefox
......@@ -58,7 +50,7 @@ function recalculateSumLine(idx, element) {
}
if (v) { sum += v; }
}
jQuery(element).text(format(sum));
jQuery(element).text(sum);
});
}
......@@ -79,7 +71,7 @@ function recalculateSumColumn(idx, element) {
}
if (v) { sum += v; }
}
me.text(format(sum));
me.text(sum);
}
function addTotalColumnToMatrixBox() {
......@@ -112,7 +104,7 @@ function listenToInputChange(matrixbox_container) {
sum,
previous_value,
actual_value;
$('td input').bind('input', null, function (e) {
$('div.matrixbox_production_planning td input').bind('input', null, function (e) {
var input = $(this);
if (input[0].getAttribute('value') != input[0].value) {
input.addClass('change');
......@@ -126,14 +118,14 @@ function listenToInputChange(matrixbox_container) {
actual_value = parseInt(input[0].value) || 0;
sum = sum + (actual_value - parseInt(previous_value));
input[0].setAttribute('data-previous-value', actual_value);
sum_span.text(format(sum));
sum_span.text(sum);
});
}
function listenToInputPaste(matrixbox_container) {
matrixbox = $(matrixbox_container.querySelector('.MatrixContent'));
$('td input').bind('paste', null, function (e) {
$('div.matrixbox_production_planning td input').bind('paste', null, function (e) {
var i, j,
input,
td_index = $(e.target.parentElement.parentElement).index(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment