Skip to content

Replies

0
Attila Tóth
Attila Tóth answered on Nov 20, 2015 12:44 PM

Hi! I tried to do the same, but nothing happens. It looks like the event not raises. I've downloaded the sample and write it in Razor 

This is my code:

@(Html.Infragistics()
.Grid(Model)
.ID("DeliveryMethodsGrid")
.Width("100%")
.PrimaryKey("ID")
.AutoGenerateColumns(false)
.AutoGenerateLayouts(false)
.Columns(column =>
{
column.For(x => x.Name).HeaderText("Name").Width("100%");

})
.Features(features =>
{
features.Filtering().Mode(FilterMode.Advanced).ColumnSettings(setting =>
{
setting.ColumnSetting().ColumnKey("Name").AllowFiltering(true);

});
features.Updating().EditMode(GridEditMode.None).EnableAddRow(true).EnableDeleteRow(true).ColumnSettings(cs =>
{
cs.ColumnSetting().ColumnKey("Name").Required(true).EditorOptions("type: 'text',validatorOptions: { onblur: true, keepFocus: 'once', checkValue: function(evt, ui) { var value = ui.value; var rows = $('#DeliveryMethodsGrid').igGrid('rows'); for (var i = 0; i < rows.length; i++) { var currentRow = rows[i]; var currentValue = $('#DeliveryMethodsGrid').igGrid('getCellValue', $(currentRow).attr('data-id'), 'Name'); if (value == currentValue && $(currentRow).find('.ui-iggrid-editingcell').length == 0) { ui.message = 'This value alredy exist in the column. Duplicated values are not allowed.'; return false; } } }}");
});
features.Sorting().ColumnSettings(cs =>
{
cs.ColumnSetting().ColumnKey("Name").AllowSorting(true);
});
})
.DataSourceUrl(Url.Action("GetAllForGrid"))
.UpdateUrl(Url.Action("SaveGrid"))
.DataBind()
.Render()
)