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
1845
Grid Column Formatter with parameters
posted

Is there any way to pass parameters to the column's "formatter" option function from MVC?  

I need to use regional settings, so I can't use the built-in format option because it uses en-US settings only.  So, I'm using the formatter option to format my fields with regional settings, but I'd like to be able to specify the number of decimal places allowed in my "toRegionalDecimalString" function, for example.

Parents
  • 6279
    Verified Answer
    posted

    Hi Josh,

    I'm afraid that the formatter function is called by the igGrid with just one parameter, so even if you have a formatter function with 2, 3 or more input parameters, they will not be honored by the function call.
    (it doesn't matter if you configure the grid via JavaScript or via the MVC wrapper)

    So alternatively to a secondary input parameter, you can have a global JS variable which you can take into account in the body of the formatter function.

    However, the good news is we do ship regional settings alongside with localization settings for our jQuery controls :).

    The point is that these regional settings aren't well documented (a flaw which will be taken care of in the next volume release's documentation), but you can still use them.
    They're located in this folder:
     C:\Program Files (x86)\Infragistics\NetAdvantage 2012.1\jQuery\js\modules\i18n\regional

    You can pick your region of choice's JS file and add a reference to it in order to receive the regional settings described in it.
    The only trick is that you need to reference such a regional JS file after the reference to the infragistics.util.js file.

    I've attached an HTML sample page which demonstrates the Finnish regional settings being applied to the igGrid's column (in this case: a number and date columns).

    Let us know if you need any further assistance with "regionalizing" our jQuery controls. 

    Cheers,
    Borislav 

    t71457.zip
Reply Children