Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to Make a CELL non editable

    Hi,

    I have a list grid with two rows of data fetched from data base. I have four fields(columns). Now i should not be able to edit my first row but the second row must be editable. How to disable editing row wise, and for that matter cell wise also.

    #2
    See listGrid.recordEditProperty for disabling editing on a row by row basis, and listGrid.canEditCell() for complete cell by cell control.

    Comment


      #3
      How to Make a Row non editable

      Hi,

      I want to make an entire row non-editable in the list grid.

      The explanation that is provided in the reference is not clear.

      Can you please provide an implementation example for my query.


      Thanks,
      Vini.

      Comment


        #4
        What's not clear - which API? canEditCell() is intended as a method you would override.. does that help?

        Comment


          #5
          How to Make a CELL non editable

          canEditCell() returns me a boolean value indicating whether that cell is editable or non-editable.

          But I want to set a cell as editable or non-editable, not to get the property.

          Comment


            #6
            Replace the ListGrid canEditCell() method with one of your own that returns true/false according to your needs. This way the grid itself calls your method to determine if the cell if editable or not.

            Comment


              #7
              Quite right davidj6. For some reason many people do not understand that you are meant to override this method, so we've now made the docs super explicit:

              Can this cell be edited?

              The default implementation respects the various property settings affecting editability: field.canEdit disables editing for a field, a record with the recordEditProperty set to false is not editable, and disabled records are not editable.

              You can override this method to control editability on a cell-by-cell basis. For example, if you had a grid that allows editing of "orders", and you had a field "shipDate" that is normally editable, but should not be editable if the order is already "complete", you might implement canEditCell() as follows:

              Code:
                 isc.ListGrid.create({
                     ...
                     canEditCell : function (rowNum, colNum) {
                         var record = this.getEditedRecord(rowNum),
                             fieldName = this.getFieldName(colNum);
                         if (fieldName == "shipDate" && 
                             record.orderStatus == "complete") 
                         {
                             return false;   
                         }
                         // use default rules for all other fields
                         return this.Super("canEditCell", arguments);
                     }
                 });
              Notes on providing custom implementations:

              o In order to allow complete control over editing, canEditCell() is called very frequently. If you see delays on row to row navigation, check that your implementation is efficient
              o If you change the editability of a cell on the fly, for example, during ListGrid.editorExit() on another cell, call refreshCell() to show or hide the editor
              o If this ListGrid allows new records to be created, canEditCell() may be called when there is no record available. The values input so far by the user are available via ListGrid.getEditValues().
              Last edited by Isomorphic; 8 Apr 2009, 13:16.

              Comment

              Working...
              X