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
360
Direct edtion in a cell.
posted

Hello,

I'm working on using the grid Updating feature. I noticed that on the first click on a cell that can be edited the current behaviour is that the cell/row enters in edition mode but it doesn't change the value. Sometimes I found it a bit weird for exemple when the column is boolean and rendered as a checkbox. in this case I would like it to change the value of the cell on the first click (only on the chek box). Is there an out of the box way of doing so? or is there an acceptable work arround ?

Best regards.

Parents
No Data
Reply
  • 1320
    Offline posted

    Hello Vincent,

    After investigating this further, I determined that by default on single click the cell enters edit mode and new value could be set. Additionally, the checkbox state could be changed on single click by binding a method to the cellClick event. In this method it is checked whether the clicked column is the checkbox column, if this is true, new value is set to the checkbox.

    cellClick: function (evt, ui) {

                        if (ui.colKey == "Active") {

                            if ($("#grid").igGrid("getCellValue", ui.rowKey, "Active") == true) {

                                $("#grid").igGridUpdating("setCellValue", ui.rowKey, "Active", false);

                            }

                            else {

                                $("#grid").igGridUpdating("setCellValue", ui.rowKey, "Active", true);

                            }

                        }

                    },

    Additionally, the checkbox column value is being changed programmatically and it is not entering edit mode, this is why editCellStarting should be canceled for the checkbox column.

    editCellStarting: function(evt, ui) {

                        if(ui.columnKey == "Active")

                            return false;

                    }

    Below I am attaching the modified sample, demonstrating the described behavior. Please test it on your side and let me know if you need any further information regarding this matter.

    Regards,
    Monika Kirkova,
    Infragistics

    igGridCheckboxSingleClick.zip

Children