Skip to content
Snippets Groups Projects
Commit 9c180a0c authored by juanf's avatar juanf
Browse files

SSDM-3292 : Making text of grids have a max length for all grids.

SVN: 35898
parent 4c93ae80
No related branches found
No related tags found
No related merge requests found
...@@ -722,7 +722,7 @@ function MainController(profile) { ...@@ -722,7 +722,7 @@ function MainController(profile) {
permId : sample.permId, permId : sample.permId,
code : sample.code, code : sample.code,
sampleTypeCode : sample.sampleTypeCode, sampleTypeCode : sample.sampleTypeCode,
matched : $container matched : $container[0].outerHTML
}); });
} }
......
...@@ -79,26 +79,11 @@ var ExperimentDataGridUtil = new function() { ...@@ -79,26 +79,11 @@ var ExperimentDataGridUtil = new function() {
var newVocabularyColumnFunc = getVocabularyColumn(propertyType); var newVocabularyColumnFunc = getVocabularyColumn(propertyType);
propertyColumnsToSort.push(newVocabularyColumnFunc()); propertyColumnsToSort.push(newVocabularyColumnFunc());
} else { } else {
var maxLineLength = 300;
var getRenderFunction = function(propertyType) {
return function(data) {
var propValue = data[propertyType.code];
if(propValue) {
propValue = propValue.substring(0, maxLineLength);
if(data[propertyType.code].length > maxLineLength) {
propValue += "...";
}
}
return propValue;
}
}
propertyColumnsToSort.push({ propertyColumnsToSort.push({
label : propertyCodesDisplayNames[idx], label : propertyCodesDisplayNames[idx],
property : propertyCodes[idx], property : propertyCodes[idx],
isExportable: true, isExportable: true,
sortable : true, sortable : true
render : getRenderFunction(propertyType)
}); });
} }
} }
......
...@@ -135,27 +135,12 @@ var SampleDataGridUtil = new function() { ...@@ -135,27 +135,12 @@ var SampleDataGridUtil = new function() {
var newVocabularyColumnFunc = getVocabularyColumn(propertyType); var newVocabularyColumnFunc = getVocabularyColumn(propertyType);
propertyColumnsToSort.push(newVocabularyColumnFunc()); propertyColumnsToSort.push(newVocabularyColumnFunc());
} else { } else {
var maxLineLength = 300;
var getRenderFunction = function(propertyType) {
return function(data) {
var propValue = data[propertyType.code];
if(propValue) {
propValue = propValue.substring(0, maxLineLength);
if(data[propertyType.code].length > maxLineLength) {
propValue += "...";
}
}
return propValue;
}
}
propertyColumnsToSort.push({ propertyColumnsToSort.push({
label : propertyCodesDisplayNames[idx], label : propertyCodesDisplayNames[idx],
property : propertyCodes[idx], property : propertyCodes[idx],
isExportable: true, isExportable: true,
sortable : true, sortable : true
render : getRenderFunction(propertyType)
}); });
} }
} }
......
...@@ -335,7 +335,8 @@ $.extend(Grid.prototype, { ...@@ -335,7 +335,8 @@ $.extend(Grid.prototype, {
renderData : function(dataList) { renderData : function(dataList) {
var thisGrid = this; var thisGrid = this;
var items = []; var items = [];
var maxLineLength = 300;
dataList.forEach(function(data) { dataList.forEach(function(data) {
var item = {}; var item = {};
thisGrid.getVisibleColumns().forEach(function(column) { thisGrid.getVisibleColumns().forEach(function(column) {
...@@ -344,6 +345,9 @@ $.extend(Grid.prototype, { ...@@ -344,6 +345,9 @@ $.extend(Grid.prototype, {
value = column.render(data); value = column.render(data);
} else { } else {
value = data[column.property]; value = data[column.property];
if(value && value.length > maxLineLength) {
value = value.substring(0, maxLineLength) + "...";
}
} }
item[column.property] = FormUtil.sanitizeRichHTMLText(value); item[column.property] = FormUtil.sanitizeRichHTMLText(value);
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment