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
290
igGridUpdating and Numeric Editor seperators
posted

We are using 2012.1, MVC2 and IE8. We are passing a GridModel to the view, with cell editing enabled using the numeric editor type. At runtime, when the grid is created, we set the GroupSeperator and DecimalSeperator properties of the ColumnUpdatingNumericEditorOptions class to string.Empty. However, at runtime the values in the cells always contain commas. 

We then attempted to reset the value during iggridupdatingeditcellended via ui.editor.igNumericEditor('option', 'groupSeparator', ''). This also had no effect.


What am I missing?


Thanks,

Bob


Parents
  • 6279
    Verified Answer
    posted

    Hi Bob,

    Here's the code you need to use for the Updating ColumnSettings of a given column in order to set custom values for the groupSeparator and decimalSeparator:

    .Features(feature => {
        feature.Updating().ColumnSettings(colSettings => {
            colSettings.ColumnSetting().ColumnKey("DelegatedSpace").EditorType(ColumnEditorType.Numeric).EditorOptions("decimalSeparator:'!',groupSeparator:'^'");
        });
    })
    


    Also, here's the code you need to change those value at runtime (resetting them to empty strings, based on your scenario):

    <script type="text/javascript">
        $(function () {
            $("#Grid1").live('iggridupdatingeditcellended', function (evt, ui) {
                if (ui.columnKey == "DelegatedSpace") {
                    $(ui.editor).igEditor("option", "groupSeparator", "");
                    $(ui.editor).igEditor("option", "decimalSeparator", "")
                }
            });
        });
    </script>
    


    The trick is that no matter what ig*Editor you are using, you will always need to configure the igEditor and not the ig*Editor - this is especially true in MVC scenario .
    Viktor Snezhko (the creator of the igEditors) has pointed this out several times in the forums and I do believe that it's also mentioned somewhere in the official Developers Guide.

    PS: I'm attaching an MVC3 (sorry - it's the only one I could put up on such short notice) sample illustrating the code I've provided. 

    Cheers,
    Borislav 

    t72443.zip
Reply Children