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
3790
changeing a format after data is ready.
posted

I figured this would work

 $( this.gridIDMap.option( "columns" ) )[c].format = "#.###";

my column remains the same, do I need to refresh something?

Parents
No Data
Reply
  • 1015
    Suggested Answer
    posted

    I don't know about changing the format after initialization.  I haven't seen a way to do that. 

    As an alternative, you could create an unbound column that uses a formula and has the format you want.

    Then hide your other column and use the unbound column.

    Set your columns similar to this when setting up your grid:

    { headerText: "MyField", key: "MyField", dataType: "number", format: "###.#######", hidden: true},

    { headerText: "MyFormattedField", key: "MyFormattedField", dataType: "number", unbound: true, format: "#.###", formula: formatMyField, width: 70 } 

     

    Then in a javascript function:

     

    function formatMyField(data, grid) {

    return data["MyField"];

     

    }

     

    Then you can hide and show columns with the following:

     

    $("#YourGrid").igGrid("hideColumn", "MyField");

     $("#YourGrid").igGrid("showColumn", "MyFormattedField");

     

     

     

     

Children