Hello!
I have an igGrid with updating feature.
I can not validate the value that use entered.
On last year. I used Infragistics 14.2 and it work fine but now I upgrated to 15.2 and it's not working
Here is my code:
@(Html.Infragistics() _.Grid(Of TPG.Position.Models.tbl_PG_CostOfFunds_Ts) _.ID("grdCostOfFunds") _.Width("100%") _.AutoGenerateColumns(False) _.AutoGenerateLayouts(False) _.AutofitLastColumn(True) _.EnableUTCDates(False) _.RenderCheckboxes(True) _.PrimaryKey("lCostOfFund_ID") _.AutoCommit(True) _.Columns(Sub(column)column.For(Function(x) x.lCostOfFund_ID).Hidden(True)column.For(Function(x) x.lPositionID).Hidden(True)column.For(Function(x) x.dtEffectiveDate).DataType("date").Format("MM/dd/yyyy").Width(100)column.For(Function(x) x.dblCostOfFund).DataType("number").Format("#,###,##0.000000").Width(200)column.For(Function(x) x.dblSpread).DataType("number").Format("#,###,##0.000000").Width(190)End Sub) _.Features(Sub(feature)feature.Updating.ColumnSettings(Sub(cs)
cs.ColumnSetting.ColumnKey("lPositionID").DefaultValue(Model.psintID)cs.ColumnSetting.ColumnKey("dtEffectiveDate").EditorType(ColumnEditorType.DatePicker).Required(True).EditorOptions("validatorOptions: { onblur: true, keepFocus: 'once', checkValue: validategrd_CostOfFunds}")cs.ColumnSetting.ColumnKey("dblCostOfFund").EditorType(ColumnEditorType.Numeric).Required(False)cs.ColumnSetting.ColumnKey("dblSpread").EditorType(ColumnEditorType.Numeric).Required(False)End Sub)feature.Sorting()feature.Filtering()feature.Resizing()feature.Responsive()End Sub) _.DataSourceUrl(Url.Action("GetDataForCostOfFunds", "Position", New With {.id = Model.psintID})) _.UpdateUrl((Url.Action("SaveGridCostOfFunds", "Position", New With {.id = Model.psintID}))) _.DataBind() _.Render())
<script type="text/javascript">
function validategrd_CostOfFunds(evt, ui) {var value = ui.value;var rows = $("#grdCostOfFunds").igGrid("rows");for (var i = 0; i < rows.length; i++) {var currentRow = rows[i];var currentValue = new Date(currentRow.cells[0].innerText);if (dates.IsEqualDate(value, currentValue) && $(currentRow).find(".ui-iggrid-editingcell").length == 0) {ui.message = "Duplicate Effective date.";return false;}}return true;}
</script>
don't anyone help me?
Hello Cuong,
Please note that the editors validatorOptions are based on options supported by igValidator widget. Since v15.2 the igValidator API has been changed and now it provides the following options and events:
- options: http://help.infragistics.com/jQuery/2015.2/ui.igvalidator#options
- events: http://help.infragistics.com/jQuery/2015.2/ui.igvalidator#events
So if you want to apply validation to your editor column, you should use the available options exposed in the above mentioned links. If you need further assistance, please let me know.
Regards,
Tsanna