Просмотр исходного кода

Export indentation as per tree report (#2882)

* Export indentation as per tree report

* Export indentation as per tree report fixed tabs and hardcoded
version-14
RicardoJohann 8 лет назад
committed by Rushabh Mehta
Родитель
Сommit
e395de340e
1 измененных файлов: 18 добавлений и 0 удалений
  1. +18
    -0
      frappe/public/js/frappe/misc/tools.js

+ 18
- 0
frappe/public/js/frappe/misc/tools.js Просмотреть файл

@@ -77,6 +77,14 @@ frappe.slickgrid_tools = {
get_filtered_items: function(dataView) {
var data = [];
for (var i=0, len=dataView.getLength(); i<len; i++) {
// remove single quotes at start and end of total labels when print/pdf
var obj = dataView.getItem(i);
for (var item in obj) {
if(obj.hasOwnProperty(item) && typeof(obj[item]) == "string"
&& obj[item].charAt(0) == "'" && obj[item].charAt(obj[item].length -1) == "'") {
dataView.getItem(i)[item] = obj[item].substr(1, obj[item].length-2);
}
}
data.push(dataView.getItem(i));
}
return data;
@@ -94,6 +102,16 @@ frappe.slickgrid_tools = {
if(val===null || val===undefined) {
val = "";
}
if(typeof(val) == "string") {
// export to csv and get first or second column of the grid indented if it is. e.g: account_name
if((i<3) && d['indent'] > 0 && (isNaN((new Date(val)).valueOf()))) {
val = " ".repeat(d['indent'] * 8) + val;
}
// remove single quotes at start and end of total labels when export to csv
if(val.charAt(0) == "'" && val.charAt(val.length -1) == "'") {
val = val.substr(1, val.length-2);
}
}
row.push(val);
});



Загрузка…
Отмена
Сохранить