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
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
Thanks for your help, Borislav. Although I'm scratching my head over having to pass the HTML helper a json string instead of configuring the editor through properties of the class. Perhaps IG will fix this in an upcoming release.
Hi Bob,
The EditorOptions (and the ValidatorOptions as well) require a JSON because adding logic in the MVC wrappers for them wasn't possible in the volume release (due to time constraints).
Hopefully we will add the logic in one of the future releases.Thanks for understanding the matter.
Cheers,Bobby
Bobby,
How should I accomplish this within a C# GridModel object? Using cs.EditorOptions = "maxValue:1000000,dataMode:'int',groupSeparator:'^'"; Doesn't work.