I use Infragistics.Web.Mvc version 3.12.1.2023.
I define my igGrid in this way:
@( Html.Infragistics().Grid<BoletaDetalleView>().ID("igGridDetalle").PrimaryKey("Guid")
.Columns(column =>
{
column.For(x => x.Remuneracion).DataType("number").HeaderText("Remuneracion").Width("10%"); column.For(x => x.ImporteRetencion).DataType("number").HeaderText("Retencion").Width("10%"); column.For(x => x.Guid).DataType("string").HeaderText("GUID").Hidden(true);})
.Features(features =>{ features.Sorting().Mode(SortingMode.Single).ColumnSettings(settings => { settings.ColumnSetting().ColumnKey("ApellidoNombre").AllowSorting(true);
}); features.Selection().MouseDragSelect(true).MultipleSelection(false).Mode(SelectionMode.Row);
features.Updating().EditMode(GridEditMode.Cell);
})
.ClientDataSourceType(ClientDataSourceType.JSON).DataSource(new List<BoletaDetalleView>().AsQueryable()).Width("100%").AutoCommit(true).DataBind().Render())
I want to calculate a value of cell "Retencion" when I change value of "Remuneracion" . I´m using this to do the job:
$("#igGridDetalle").live("iggridupdatingeditcellending", function (event, ui) {
if (!ui.editor) { return false; }
if (ui.columnKey === 'Remuneracion') { var myValue=123; var p= $("#igGridDetalle").igGrid("setCellValue", ui.rowID,'ImporteRetencion',myValue);return true;}
});
but the value of 'ImporteRetencion' never changes. Is there another way to do this?
Hi,
setCellValue is method of igGridUpdating. I guess that your mistake is that you're trying to execute setCellValue on igGrid insead of igGridUpdating.
Try this code for editCellEnding event:
Hope this helps,
Martin Pavlov
Infragistics, Inc.
Hi. Thanks for reply .
If i do what you say i get this error:
Microsoft JScript runtime error: Unable to set value of the property 'Remuneracion': object is null or undefined
I tried this and now works.
$("#igGridDetalle").live("iggridupdatingeditcellended", function (event, ui) {if (ui.columnKey==='Remuneracion') {
var myValue= 123; $("#igGridDetalle").igGridUpdating("setCellValue", ui.rowID,'ImporteRetencion',myValue); }
Is this way correct?
Sure, it is correct.
I didn't have problems using the editCellEnding event either.
Best regards,
hello
i used that way but i recieve an error 'Uncaught TypeError: $(...).live is not a function'
can you help me to resolve this problem!
thanks u very much
Hello Cuong,
jQuery.live function is removed from jQuery 1.9 code, so you probably have a newer version of the jQuery library referenced in your code. Try using the jQuery.on function instead.
Here is a sample code:
$("#igGridDetalle").on("iggridupdatingeditcellended", function (event, ui) {});
Best regards,Martin PavlovInfragistics, Inc.
thanks for your helper!