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
1460
startEditTriggers do not work if grid also has Selection
posted

If the grid has Selection and Updating, setting the startEditTriggers doesn't work.  Only double-clicking will work to initiate edit mode.  Click or F2 will not.

 

 

grid.igGrid(
                { columns: buildColumns(),
                    features: [
                        {
                            name: "Sorting",
                            type: "local"
                        },
                        { name: "Selection",
                            mode: "cell",
                            multipleSelection: false,
                            activation: true,
                            cellSelectionChanged: function (evt, ui) {
                                var actualRowIdx = ui.cell.row[0].rowIndex - 1 // rowIndex is not zero based (and varies both on naming standard and zero-base depending on which event is being used [good times indeed]), but methods expect a zero-based index 
                                if (ui.cell.columnKey === 'NextRound') {
                                    var myCell = grid.igGridSelection('getCellValue', actualRowIdx, 'NextRound');
                                    var dataview = grid.data('igGrid').dataSource.dataView();
                                    var myVal = dataview[actualRowIdx]["NextRound"];

				    grid.igGridUpdating("setCellValue", actualRowIdx, 'NextRound', !(myVal));
                                    dataview[actualRowIdx]["NextRound"] = !(myVal);

                                    grid.igGridSelection('deselectCell', actualRowIdx, ui.cell.index);
                                    grid.igGridUpdating('endEdit');

                                    grid.igGridSelection("clearSelection");
                                }
                                else {
                                    // grid.igGridSelection('selectCell', actualRowIdx, ui.cell.index );
                                    grid.igGridUpdating('startEdit', actualRowIdx, ui.cell.index);
                                }

                            }
                        },
                        { name: 'Updating',
                            editMode: 'cell',
                            enableAddRow: false,
                            enableDeleteRow: false,
                            validation: true,
                            startEditTriggers: 'click,dblclick,enter',                             editCellEnded: function (evt, ui) {

//NOTE: editCellEnded likes attention, it also likes to fire when entering edit mode on a cell }, editCellEnding: function (evt, ui) { //TODO: check valid value (number, not used previously, not more than # of competitors) & return false with alert if not ok if(ui.value!='' && isNaN(ui.value)){ alert('Not a valid scoring number'); //evt.stopPropagation(); evt.stopImmediatePropagation(); evt.preventDefault(); return false; //NOTE: see the mighty "editCellEnding" in action, its event propagation is unstoppable
                                }
                            }
                           
                        }],
                    width: "100%",
                    dataSource: CompetitionRound.RoundCompetitors,
                    autoGenerateColumns: false,
                    renderCheckboxes: true
                });

 

Parents
  • 23953
    Offline posted

    Hi,

     

    First you didn't define F2 in startEditTriggers so it is normal not to work.

    When you define 'click' and 'dblclick' at the same time only the 'dblclick' works. I believe this is by design, because I couldn't find bug on the subject and this behavior dates back in 11.1.

    When you use Updating and Selection together and you have defined 'click' as startEditTrigger you first need one click to make the selection and then you need second click to start editing. This is by design.

     

    Hope this helps,

    Martin Pavlov

    Infragistics, Inc.

Reply Children