Toggling a ListGrid boolean field without entering Edit mode

Hi,

I’m looking for confirmation that I’ve taken the ‘best’ approach here, I have a sample that works as desired:

  • Toggle of a ListGrid’s boolean cell works without visibly entering Edit mode (I normally run business logic in rowClick(), entering into Edit mode bypasses that logic)
        isc.ListGrid.create({
            ID: "aList",
            width: "100%",
            height: "100%",
            dataSource: isc.DataSource.create({
                            ID: "aDS",
                            fields:[
                                { name:"ID", type: "sequence", primaryKey: "true" },
                                { name: "name" },
                                { name: "yesNo", type: "boolean" }
                            ],
                            clientOnly: true,
                            testData: [
                              {
                                ID : 1,
                                name: "Enrico Fermi",
                                yesNo : false
                              },
                              {
                                ID : 2,
                                name:"Isaac Newton",
                                yesNo : false
                              },
                              {
                                ID : 3,
                                name:"JC Maxwell",
                                yesNo : false
                              },
                              {
                                ID : 4,
                                name:"Carl Sagan",
                                yesNo : false
                              },
                              {
                                ID : 5,
                                name:"Ernest Rutherford",
                                yesNo : false
                              },
                              {
                                ID : 6,
                                name:"Stephen Hawking",
                                yesNo : false
                              },
                              {
                                ID : 7,
                                name:"Niels Bohr",
                                yesNo : false
                              },
                              {
                                ID : 8,
                                name:"Heinrich Hertz",
                                yesNo : false
                              },
                              {
                                ID : 9,
                                name:"Albert Einstein",
                                yesNo : false
                              }
                            ]
                        }),
            selectionType: "single",
            autoFetchData: true,
            autoSaveEdits: false,
            selectionType: "single",
            //canEdit: true,
            fields:[
              { name: "ID", title: "PK", width: 50, canFilter : false
              , canEdit: false 
              },
              {name:"yesNo", title:"Alive?", width : 100,  canEdit: true,  editEvent: "click", // doubleclick click rowClick
                canToggle: true 
              },
              { name: "name", title : "Physicist", canEdit: false },
            ],
            rowClick : function (record, rowNum, colNum) { 
              this.Super("rowClick", arguments);
            }
            ,editorEnter : function (rowNum, colNum) { this.endEditing(); return false; }
        });

Removing the line:

,editorEnter : function (rowNum, colNum) { this.endEditing(); return false; }

from the sample causes the undesirable behaviour to occur i.e. Edit mode entry upon doubleclicking a boolean cell.

Is this the ‘best’ solution?

If what you want is no editing other than the one toggle field, just set editEvent:“none”, but note it’s a ListGrid-wide setting, not something set on a per-field basis.

Thanks, that’s much simpler

Thanks again & continued kudos to the team!