Sort Editable Grid By Column Values

Creating sortable columns in a read-only grid seems very straightforward, but I cannot figure out how to do this in an editable grid. I am trying to do this for a numeric decimal column, but would also like the grid to be sortable by multiple columns. Please let me know any suggestions or resources. 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    This is possible to do via workarounds like Drew mentions, but there's a reason the editable grid isn't inherently sortable by column - when the data within is actually editable, then trying to change the sort (while pending edits are in place, etc) is just a nightmare.  Therefore I strongly recommend against this.  If you need sorting, use read-only.  If you need editable, then sort the data at the start in a manner that will be suitable until editing is completed.

  • 0
    Certified Senior Developer
    in reply to Mike Schmitt

    Hi,

    I want to sort the display order column in the editable grid and is this the way it should be done?

    How do I know if its working?

     

    a!localVariables(
      local!QRSuppliers: a!queryEntity(
        entity: cons!BC_SUPPLIER_DSE,
        query: a!query(
          selection: a!querySelection(
            columns: {
              a!queryColumn(field: "supplierId"),
              a!queryColumn(field: "description"),
              a!queryColumn(field: "displayOrder"),
              a!queryColumn(field: "createdDate"),
              a!queryColumn(field: "createdBy"),
              a!queryColumn(field: "modifiedDate"),
              a!queryColumn(field: "modifiedBy"),
              
            }
          ),
          pagingInfo: a!pagingInfo(
            startIndex: 1, 
            batchSize: - 1,
            sort: a!sortInfo(field: "displayOrder", ascending: true)
          )
        ),
        fetchTotalCount: true
      ).data,

    Thanks

  • +1
    Certified Lead Developer
    in reply to Sandhya

    You should be able to just run that query by itself and verify whether it comes out ordered the way you want.

  • 0
    Certified Senior Developer
    in reply to Mike Schmitt
      • supplierId1(Number (Integer))
        • description"Lockheed Martin"(Text)
          • displayOrder5(Number (Integer))
            • Dictionary
              • supplierId3(Number (Integer))
                • description"Office Mart"(Text)
                  • displayOrder8(Number (Integer))
                    • Dictionary
                      • supplierId2(Number (Integer))
                        • description"Dell"(Text)
                          • displayOrder15(Number (Integer))

                          It's working. 

                          Thanks

                        Reply Children
                        No Data