Announcement

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

    ListGrid ListEndEditAction with default values on action RowEndEditAction.NEXT

    Hi,
    I am using GWT 2.8.2 and SmartGWT 6.1-p20170724 power version.

    When I use ListGrid.setListEndEditAction(RowEndEditAction.NEXT), a new row get inserted on last cell tab-out or down-key press on last row with empty cell, However I need to add a sequence number etc. in newly added record.
    I tried using defaultValues too for same but it can not be achieved by listgrid.defaultValues as sequence number vary on each row.

    So, How I can add values for 'sequence number' and other field in listgrid while tabbing out on last cell of the last row. If achievable please tell me how to stop new row insertion on down-key press as well? As I need to insert new row on tabbing out only.

    --
    Thanks

    #2
    You can use the rowEditorEnter event and make a setEditValue() call.

    However this usage is a little weird. It's not clear why you would be providing a sequence value from a client system, as that seems to run the risk of colliding sequence values. Be sure you've read the Handling Unsaved Records overview as you look like you may be going down the wrong path.

    Comment


      #3
      Hello Team,
      Thanks for reply.

      I am providing sequence value from client side as user can insert row in middle, can copy existing row to below same row and insert row at the end. Colliding sequence is handled as i am updating row on RowEditorExit event so at a time single row can add new sequence. In case of insertion/deletion in middle sequence updated to subsequent row as well.
      Now i just want to add a new record with incremented sequence number on tab-out on last cell of last row. (Note- sequence number is not primary key instead another invisible column 'id' is primary key)

      I am having trouble updating sequence number on RowEditorEnter event on inserting in middle of the listgrid.
      --
      Kind regards

      Comment


        #4
        Again, we referred to colliding sequence values between *different users*, so no, your approach doesn't address this.

        As we explained you read the Handling Unsaved Record overview. It seems like you are trying to reorder records which are regarded as unsaved, which won't work, as explained in that overview. Also explained are alternative approaches.

        Comment


          #5
          Hi Isomorphic,

          Thanks for reply.
          I have removed updation of sequence on new row insert.
          However i have two questions
          1. How can i make ListGrid.setListEndEditAction(RowEndEditAction.NEXT) to insert new row only on Tab-out of last column but not on down key?
          2. Can i make it behave like startEditingNew(Record defaultRecordValue) on Tab-out?
          Last edited by sidharth1917; 30 Aug 2018, 04:14.

          Comment


            #6
            Hi Isomorphic,

            Any update on this?

            --
            Kind Regards

            Comment


              #7
              Those two questions seem to be the same question. You would want to set the listEndEditAction to "none" and then implement a bodyKeyPress handler that looks for a tab keypress in the last column and calls startEditingNew().

              However, frankly, this change is simply worse than the default behavior, so you probably shouldn't do it.

              Comment

              Working...
              X