Commit 9b347550a3bfcc5e80e9509afc844711f799d867

Authored by Nathanael Jourdane
1 parent 49401187

epntap serviceGrid: Improve nbRes display

Showing 1 changed file with 13 additions and 1 deletions   Show diff stats
js/app/views/EpnTapUI.js
... ... @@ -426,6 +426,18 @@ Ext.define('amdaUI.EpnTapUI', {
426 426 service granules.
427 427 */
428 428 createServicesGrid: function() {
  429 + var nbResRender = function(val) {
  430 + if(val<0 || isNaN(val)) {
  431 + return '-';
  432 + } else if(val >= 1000*1000) {
  433 + return (val/(1000*1000)).toPrecision(3) + 'm';
  434 + } else if(val >= 1000) {
  435 + return (val/1000).toPrecision(3) + 'k';
  436 + } else {
  437 + return val;
  438 + }
  439 + };
  440 +
429 441 var epnTapServicesGrid = new Ext.grid.Panel({
430 442 id: 'epnTapServicesGrid',
431 443 title: 'Services',
... ... @@ -433,7 +445,7 @@ Ext.define(&#39;amdaUI.EpnTapUI&#39;, {
433 445 flex: 1,
434 446 columns: [
435 447 {text: 'Name', dataIndex: 'short_name', flex: 3},
436   - {text: 'nb results', dataIndex: 'nb_results', flex: 2}
  448 + {text: 'nb results', dataIndex: 'nb_results', flex: 2, renderer: nbResRender}
437 449 ],
438 450 viewConfig: {
439 451 getRowClass: function(record, index) {
... ...