jQuery UI Widgets Forums Grid Change value after user has entered

This topic contains 5 replies, has 3 voices, and was last updated by  Sameer Ahmed 6 years, 12 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • Change value after user has entered #31819

    Zylin
    Participant

    Two questions:

    Want to invoke the following user experience. When they edit a particular value, the value in the grid is automatically changed to uppercase. I’ve tried setting the value of the cell, but everything I’ve tried does not seem to effect the changed value.

    Different case, upon value changing, change column values in other rows so a sequence can be maintained. Ie, there exists a 1, 2 & 3. Someone edits 3 and changes to 2. Want to find existing 2 and increment to 3, thus no row has the same value. I would think this is best done in the endcelledit event. If executed in cellvaluechanged, would this create an infinite loop?

    Thanks

    Change value after user has entered #31867

    Dimitar
    Participant

    Hello Zylin,

    1) To achieve this, please use the cellvaluechanging callback function:

    cellvaluechanging: function (row, datafield, columntype, oldvalue, newvalue) {
    return newvalue.toUpperCase();
    }

    2) Here is what your cellendedit function may look like:

    cellendedit: function (row, datafield, columntype, oldvalue, newvalue) {
    var rows = $('#jqxgrid').jqxGrid('getrows');
    for (var i = 0; i < rows.length; i++) {
    var currentValue = $('#jqxgrid').jqxGrid('getcellvalue', i, "Quantity");
    if (currentValue == newvalue) {
    $("#jqxgrid").jqxGrid('setcellvalue', i, "Quantity", newvalue + 1);
    break;
    };
    };
    }

    Best Regards,
    Dimitar

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

    Change value after user has entered #31903

    Zylin
    Participant

    Dimitar,

    Many Thanks. Tried the return on cellendedit and on cellvaluechanged, but didn’t know about cellvaluechanging.

    Regards,
    Steve


    Sameer Ahmed
    Participant

    Hi Ditimar,
    cellvaluechanging is called from endcelledit but i need to change the value to upper case while user is typing. How could we achive that.
    Thank you.


    Dimitar
    Participant

    Hi Sameer Ahmed,

    Here is how you can achieve this requirement: https://www.jseditor.io/?key=jqxgrid-uppercase-editor. Note the implementations of createeditor and geteditorvalue for the first column.

    Best Regards,
    Dimitar

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


    Sameer Ahmed
    Participant

    Hi Dimitar,
    Thank you for the response. It worked.

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

You must be logged in to reply to this topic.