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
Solved! Go to Solution.
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.
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.
Thanks Ken!