Announcement

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

    Suggestion on grid editing: ability to start edit new record in first row instead of last one

    Hi,
    Mobile UI getting more popular among our users so thanks for effort of yours in this area.
    I have suggestion regarding adding new records in grids:
    Now, startEditingNew() function always adds new row below all others. This is fine on desktop, but on mobile device this new editing row is usually covered by device screen keyboard thus not user friendly.
    It would be nice if new row placement has been customized or, even changed to very first row as adapt feature of mobile devices.
    What do you think?
    MichalG

    #2
    Good suggestion. We are thinking we'll implement this as autoScrollEditRow as a enum, with the values "top", "middle" and "none" as values. This allows for future expansion. "top" will be the default for touch devices, "none" for others.

    This may take a bit to implement, so please be patient. In the meantime, it would be pretty simply to add an editorEnter handler to do the same thing.

    Comment


      #3
      What I have tried so far is startEditingNew() modification using updateCaches() to insert empty row at the top of grid. Then, I used transformRequest() to change operationType to "add" instead of "update".
      Code:
          var newRowNum = this.body ? this.body.getTotalRows() : this.getTotalRows();
          if (this.getDataSource() != null) {
              var newRowNum = 0;
      
              var record = {id:"-1"};
              var dsResponse = {
                  data: [record],
                  operationType: "add"
              };
              this.getDataSource().updateCaches(dsResponse);
          }
      It even works fine for grids which have all records loaded, but fails when paging is involved.

      Could you explain more your suggestion to use editorEnter handler?
      Thanks,
      MichalG

      Comment


        #4
        These are two different things:

        1. your approach shown here means that the newly created row is actually at rowNum = 0. That's a fine approach, and we basically discuss it here as one way to created unsaved records at arbitrary indices

        2. the approach we were discussing above was to still place the newly created row at the end of the dataset as usual, but simply scroll the grid so that the row at the end of the dataset appears at the top of the grid

        Comment


          #5
          I got some progress with my approach (updateCaches()).
          The problem still not solved is index (position) of a new record inserted into grid by updateCaches:
          • if there is ascending sort by any field then record is inserted as first row of grid - that's what I need
          • if there is no sort or sort descending by any field then record is inserted as last row of grid
          Is there any way to force insertion as first row despite current sort state of grid?

          Thanks,
          MichalG

          Comment


            #6
            This seems to be a description of a partial cache situation, in which case the insertion is temporary.

            But you've kind of answered your own question: if you want it at a particular position, apply a sort such that it appears at that position. The sort need not be on a visible field.

            Comment

            Working...
            X