Select to view content in your preferred language

Declarative DataGrid- cannot format content

2690
2
Jump to solution
08-28-2014 04:40 PM
StefanCoe
New Contributor II

I have a DataGrid that gets updated when the user hovers over certain features. It works fine, but I need to format some of the fields/values. I am trying to use the formatter method that is supposed to call a function in the javascript script section. As far as I can tell, the function is not being called. Here is the markup:

 

<div id="bottomPane" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'bottom'"> <b>Financial Data:</b>   <table data-dojo-type="dojox.grid.EnhancedGrid" data-dojo-id="grid" id="grid" data-dojo-props="rowsPerPage:'5', rowSelector:'20px'" style="height:250px; width:100%">         <thead>             <tr>   <th field="Phase" width="50px" >Phase</th>   <th field="Year" width="50px">Year</th>   <th field="FedFundSource" width="50px">Funding Type</th>   <th field="FedFundAmount" formatter= "formatCost" >Federal Funding</th>   <th field="StateFundAmount" formatter= "formatCost" >State Funding</th>   <th field="LocalFundAmount" formatter= "formatCost" >Local Funding</th>   <th field="SponsorObDate" width="100px">Projected Obligation Date</th>             </tr>         </thead>         </table>       </div> 

 

 

And here is the function:

function formatCost (Cost) {    console.log("%s", "got here");   return "$" + Cost.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");                      }   

 

Any advice is much appreciated!

 

-Stefan

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

Where do you have the formatCost function? If you are using AMD style, it is within the require section? If so, the HTML markup will not be able to access it.

View solution in original post

2 Replies
KenBuja
MVP Esteemed Contributor

Where do you have the formatCost function? If you are using AMD style, it is within the require section? If so, the HTML markup will not be able to access it.

StefanCoe
New Contributor II

Thanks Ken!

0 Kudos