jQWidgets Forums

jQuery UI Widgets Forums Grid cellvaluechanged not executing when expected

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 12 years ago.

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

  • DaveB
    Participant

    I have a grid with a dropdownlist column and a button column. If I change the value selected in the dropdownlist and then click on the button I would expect that the cellvaluechanged event would fire before the buttonclick event fires for the button column. In fact, the cellvaluechanged does not fire at all until I click into another cell. I would also expect that the cellvaluechanged would fire on the dropdownlist as I select different rows using the keyboard, which would change the cell that I am in. So if I opened the dropdown and used the up/down arrows on the keyboard I would expect that the cellvaluechanged would fire for when each item was selected. That appears to be the behavior of the jqxDropDownList when used outside of a grid. Below are some modified snippets from my code for how the grid is setup. The bigger issue of the two of these behaviors for me is that it does not fire at all when I click on the button column. Is there a way around this? Will this continue to be the behavior going forward? I am using version 2.8.3.

    The dropdown and button column:

                  { text: 'Model', datafield: 'modelCd', displayfield: 'model', columntype: 'dropdownlist',width: 100,
    createeditor: function (row, value, editor)
    {
    editor.jqxDropDownList({ source: modelCdDataAdapter, displayMember: 'nme', valueMember: 'modelCd' });
    }
    },
    { text: '', datafield: 'x', columntype: 'button', width: 25,
    cellsrenderer: function ()
    {
    return "...";
    }, buttonclick: function (row)
    {
    clickedRow = row;
    model = $("#jqxgrid").jqxGrid('getcellvalue', row, 'model');
    }
    },

    The cellvaluechanged code:

            $("#jqxgrid").on('cellvaluechanged', function (event) 
    {
    var row = args.rowindex;
    alert("In cellvaluechanged newvalue=" + $("#jqxgrid").jqxGrid('getcellvalue', row, "modelCd"););
    });

    Peter Stoev
    Keymaster

    Hi,

    The “cellvaluechanged” is expected to be raised when the value of the cell is changed. This means that the Editor should be no-longer active and the editing operation should be completed. That behavior is by design.

    “cellvaluechanged” is not expected to be raised on button column because the Buttons in the column are not Editors and do not change the button cell’s value.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    DaveB
    Participant

    In my case, the effect of the button will vary based on the value of the Drop Down column. To the user, it appears that they have changed the value after selecting it from the dropdown, but the button will behave incorrectly because the new values have not yet been accepted (this is probably also the case for edit columns). Is there a way to force the changes to be accepted? Could I trigger the cellendedit event maybe to force the change to process before, possibly at the beginning of the buttonclick? Maybe even a generic accepttext type of event that would cause any existing cells that have focus to lose focus (or behave as if they had lost focus?


    Peter Stoev
    Keymaster

    Hi,

    As “cellvaluechanged” is raised on cell value changes, you may force such event by using the Grid’s “setcellvalue” method which will set a new value to a specific cell.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.