Commit b7c24aeb authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_production_planning: available for no editable

parent fc9bc801
......@@ -32,6 +32,10 @@
color: #f40;
}
.matrixbox_production_planning table tbody td span:last-child input.select{
.matrixbox_production_planning table tbody td.select span:last-child input{
background-color: #E3EAFA;
}
.matrixbox_production_planning table tbody td.select{
background-color: #aec2f1;
}
\ No newline at end of file
......@@ -159,43 +159,61 @@ function listenToInputCopy(matrixbox_container) {
matrixbox.bind('copy', null, function (e) {
var copy_data = "",
separator,
value,
tmp,
line;
e.preventDefault();
e.stopPropagation();
matrixbox.find('tr td input.select').each(function( index, element) {
index = $(element.parentElement.parentElement.parentElement).index();
matrixbox.find('tr td.select').each(function( index, element) {
index = $(element.parentElement).index();
// not space, tabulation
separator = ' ';
separator = '\t';
line = line || index;
if (line && line != index) {
separator = '\n';
line = index;
}
tmp = element.querySelector('input');
if (tmp) {
value = tmp.value;
} else {
value = element.innerText.split('\n')[0];
}
if (copy_data) {
copy_data = copy_data + separator + element.value;
copy_data = copy_data + separator + value;
} else {
copy_data = element.value;
copy_data = value;
}
});
e.originalEvent.clipboardData.setData('text/plain', copy_data);
});
$('html').bind('mousedown', null, function (e) {
if (e.buttons == 1) {
matrixbox.find('tr td input.select').removeClass('select');
matrixbox.find('tr td.select').removeClass('select');
initial_td_index = undefined;
initial_tr_index = undefined;
}
});
$('div.matrixbox_production_planning td input').bind('mousedown mouseover', null, function (e) {
$('div.matrixbox_production_planning td').bind('mousedown mouseover', null, function (e) {
if (e.buttons == 1 || e.buttons == 3) {
current_td_index = $(e.target.parentElement.parentElement).index();
current_tr_index = $(e.target.parentElement.parentElement.parentElement).index();
matrixbox.find('tr td input.select').removeClass('select');
tmp = e.target;
while(tmp.nodeName !== "TD") {
tmp = tmp.parentElement;
if (tmp.nodeName == 'DIV') {
return;
}
}
current_td_index = $(tmp).index();
current_tr_index = $(tmp.parentElement).index();
matrixbox.find('tr td.select').removeClass('select');
if (initial_td_index === undefined) {
initial_td_index = current_td_index;
initial_tr_index = current_tr_index;
e.stopPropagation();
//e.preventDefault();
// for click twice problem
if (e.target.nodeName !== "INPUT") {
//e.preventDefault();
}
} else {
var min_tr = initial_tr_index,
max_tr = current_tr_index,
......@@ -213,7 +231,7 @@ function listenToInputCopy(matrixbox_container) {
for (tmp_tr = min_tr; tmp_tr <= max_tr; tmp_tr += 1) {
tr = matrixbox.find('tr:eq(' + tmp_tr + ')');
for (tmp_td = min_td; tmp_td <= max_td; tmp_td += 1) {
input = tr.find('td:eq(' + tmp_td + ') input');
input = tr.find('td:eq(' + tmp_td + ')');
input.addClass('select');
}
}
......
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