Custom scientific(exponential) notation in all numeric columns

I am trying to display data in scientific notation, but want to set when the conversion is set. The column format does not work, scientific notation doesn't seem to be an option?
The columns need to be dynamically built, and was hoping to format based on column data type. I tried using QueryCellInfo to update the text of the cells, but that didn't work as expected. I'm pretty sure I'm missing something as I'm very new to syncfusion products.
I am using AngularJS, but can convert any possible JS solution too.

3 Replies

TS Thavasianand Sankaranarayanan Syncfusion Team October 23, 2017 12:46 PM UTC

Hi Lane, 

Thanks for contacting Syncfusion support. 

We have analyzed your query and we suspect that you want to use column values as exponential notation. By default, we don’t have any format for exponential notation in ejGrid control. So, we suggest you to use the queryCellInfo event of ejGrid control to change the column value into exponential notation using the toExponential() method.  
 
For an example, we have done it for the Freight column in ejGrid control. 

Refer the below code example. 


<div id="Grid" ej-grid e-datasource="data" e-allowpaging="true"  
e-querycellinfo = "queryCellInfo" >         
          
      <div e-columns> 
                         
         --- 
 
     </div> 
</div> 
             
    <script> 
 
       var obj = [ 
                { "EmployeeID": 1, "LastName": "Davolio", "Freight": 33.38, "Title": "Sales Representative", "City": "Seattle", "Country": "USA" }, 
                 
                --- 
   ]; 
 
        angular.module('listCtrl', ['ejangular']) 
        .controller('PhoneListCtrl', function ($scope) {                    
            $scope.data = obj; 
 
            $scope.queryCellInfo = function(args){ 
 
              if(args.column.field == "Freight") 
                 args.cell.innerText = args.rowData[args.column.field].toExponential(); 
 
          } 
        }); 
 
    </script> 


Refer the screen shot. 

 

We have prepared a simple JsPlayground sample in the following link. 


Refer the help documentation. 


Regards, 
Thavasianand S. 



LU Lane Urtel October 23, 2017 06:58 PM UTC

Thank you for the response, that is working as expected.

I had looked into the queryCellInfo process but updated an incorrect property. I did spend a little more time in the API documentation for the QueryCellInfo, and realized my mistake.




TS Thavasianand Sankaranarayanan Syncfusion Team October 24, 2017 04:27 AM UTC

Hi Lane, 
 
We are happy that the problem has been solved at your end. 
 
Please get back to us if you need any further assistance.  
 
Regards, 
Thavasianand S. 
 


Loader.
Up arrow icon