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
185
How to set cell value based on another cell value ?
posted

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?

Parents
  • 23953
    Suggested Answer
    Offline posted

    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:

    Code Snippet
    1. $("#igGridDetalle").live("iggridupdatingeditcellending", function (event, ui) {
    2.     if (!ui.editor) {
    3.         return false;
    4.     }
    5.     if (ui.columnKey === 'Remuneracion') {
    6.         var myValue=123;
    7.         var p= $("#igGridDetalle").igGridUpdating("setCellValue", ui.rowID,'ImporteRetencion',myValue);
    8.         return true;
    9.     }
    10. });

     

     

    Hope this helps,

    Martin Pavlov

    Infragistics, Inc.

Reply Children