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
1355
Validate dateeditor on igGrid
posted

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>

Parents Reply Children