jQuery UI Widgets Forums Grid Update another column cell value on input of value on grid

This topic contains 2 replies, has 2 voices, and was last updated by  lalit singh 12 years, 4 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author

  • lalit singh
    Participant

    Hi ,

    I am using jqxGrid, In a row, whenever user enters value of particular column, I want to update cell value of another column based on some calculation. For ex: there is one column sales, user will enter sales value , and the another column “gross” should update with value based on calculation. Calculation part i will mangage.

    Any Idea to update another column cell value on selected row?

    Regards,

    Lalit Singh


    Peter Stoev
    Keymaster

    Hi Lalit Singh,

    Have you tried the “setcellvalue” method? Example: http://jsfiddle.net/jqwidgets/uuW2H/

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/


    lalit singh
    Participant

    Hi Peter,

    Thanks I implemented this. Below is my implementation.

    I am binding cellendedit event to grid and then after performing calculation , setting the value. This is working fine.

    $(“#jqxgrid”).bind(‘cellendedit’, function (event) {

    var args = event.args;
    var columnDataField = args.datafield;
    var rowIndex = args.rowindex;
    var cellValue = args.value;
    var oldValue = args.oldvalue;

    if (columnDataField == “SalesFinal”) {

    var SalesFinalVal = cellValue;
    var updateCAGR = null;

    var SalesInitialVal = $(“#jqxgrid”).jqxGrid(‘getcellvalue’, rowIndex, ‘SalesInitial’);

    if (SalesFinalVal != null && SalesInitialVal) {

    updateCAGR = calculateCAGR(SalesFinalVal, SalesInitialVal);

    $(“#jqxgrid”).jqxGrid(‘setcellvalue’, rowIndex, ‘CAGRPercentageFinal’, updateCAGR);

    }

    }
    }

    I hope this is the only way , I can use it. If is there any way around , please let me.

    Regards,

    Lalit Singh

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.