Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
300
Formatting Column Data
posted

I am trying to format some column data for my grid.  Here is a sample code

autoGenerateColumns: false,

         columns: [

            { headerText: "Order #", key: "OrderNumber", dataType: "string" },

            { headerText: "Name", key: "CompanyName", dataType: "string" },

            { headerText: "Status", key: "OrderStatus", dataType: "string" },

            { headerText: "Total", key: "OrderTotal", dataType: "number", format: "currency" }

        ]

I am assuming that the format should look that way for the total, but it isn't working.  I couldn't find any code examples just the method on the help site.

thanks,

sy

Parents
  • 24497
    posted

    Hi sy,

    Your codes look correct to me and cells in last column should appear in currency format with $ symbol. If it does not work, then it is possible that your application does not have $.ig.formatter loaded. That may happen if you included only specific js files instead of combined js file with all Infragistics widgets. If that is the case, then to support formatting, you also should include ig.util.js file.

    Below is sample which I tested and it worked as expected:

    <script type="text/javascript">
     $(function () {
      $('#grid1').igGrid({
       dataSource: [ {Order: 'a', Total: 123.45}, {Order: 'b', Total: 5432.1} ],
       columns: [
        { headerText: 'Order', key: 'Order' },
        { headerText: 'Total', key: 'Total', dataType: 'number', format: 'currency'}
       ]
      });
     });
    </script>
    <table id="grid1"></table>

Reply Children
No Data