Skip to content

Commit

Permalink
Lib Samp table columns
Browse files Browse the repository at this point in the history
  • Loading branch information
hash-bash committed Oct 7, 2024
1 parent 58b7702 commit 05d305d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 24 deletions.
4 changes: 3 additions & 1 deletion backend/static/main-hub/app/components/BaseGridController.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ Ext.define("MainHub.components.BaseGridController", {
},

gridCellTooltipRenderer: function (value, meta) {
meta.tdAttr = Ext.String.format('data-qtip="{0}"', value);
if (value) {
meta.tdAttr = 'data-qtip="' + value + '"';
} else meta.tdAttr = "data-qtip=Empty";
return value;
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ Ext.define("MainHub.view.invoicing.InvoicingController", {
},

gridCellTooltipRenderer: function (value, meta) {
meta.tdAttr = Ext.String.format('data-qtip="{0}"', value);
if (value) {
meta.tdAttr = 'data-qtip="' + value + '"';
} else meta.tdAttr = "data-qtip=Empty";
return value;
},

Expand Down
58 changes: 37 additions & 21 deletions backend/static/main-hub/app/view/libraries/Libraries.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,13 @@ Ext.define("MainHub.view.libraries.Libraries", {
text: "GMO",
tooltip: "Genetically Modified Organism",
dataIndex: "gmo",
renderer: "gridCellTooltipRenderer"
renderer: function (value, meta, record) {
if (record.get("leaf")) {
return value ? "Yes" : "No";
} else {
return "";
}
}
},
{
text: "Date",
Expand Down Expand Up @@ -472,16 +478,21 @@ Ext.define("MainHub.view.libraries.Libraries", {
dataIndex: "concentration"
},
{
text: "Measuring Unit",
tooltip: "Measuring Unit",
dataIndex: "measuring_unit",
renderer: "gridCellTooltipRenderer"
},
{
text: "Measured Value",
tooltip: "Measured Value",
dataIndex: "measured_value",
renderer: "gridCellTooltipRenderer"
text: "Measurement",
tooltip: "Measured value along with its unit",
renderer: function (value, meta, record) {
var measuringUnit = record.get("measuring_unit");
var measuredValue = record.get("measured_value");

if (measuringUnit === "-") {
return "Requires Measurement";
} else
return Ext.String.format(
"{0}{1}",
measuredValue,
measuringUnit
);
}
},
{
text: "Starting Amount",
Expand All @@ -502,16 +513,21 @@ Ext.define("MainHub.view.libraries.Libraries", {
renderer: "gridCellTooltipRenderer"
},
{
text: "Measuring Unit (Output)",
tooltip: "Measuring Unit (Output)",
dataIndex: "measuring_unit_facility",
renderer: "gridCellTooltipRenderer"
},
{
text: "Measured Value (Output)",
tooltip: "Measured Value (Output)",
dataIndex: "measured_value_facility",
renderer: "gridCellTooltipRenderer"
text: "Measurement (Output)",
tooltip: "Measured value along with its unit",
renderer: function (value, meta, record) {
var measuringUnit = record.get("measuring_unit_facility");
var measuredValue = record.get("measured_value_facility");

if (measuringUnit === "-") {
return "Requires Measurement";
} else
return Ext.String.format(
"{0}{1}",
measuredValue,
measuringUnit
);
}
},
{
text: "Index Type",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ Ext.define("MainHub.view.libraries.LibrariesController", {
},

gridCellTooltipRenderer: function (value, meta) {
meta.tdAttr = 'data-qtip="' + value + '"';
if (value) {
meta.tdAttr = 'data-qtip="' + value + '"';
} else meta.tdAttr = "data-qtip=Empty";
return value;
}
});

0 comments on commit 05d305d

Please sign in to comment.