Announcement

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

    Retrieving ListGridRecords from ListGrid

    I am using SmartClient_v121p_2020-04-14_PowerEdition. I have a ListGrid backed by a DataSource. The user can drag and drop rows within the grid to specify a certain order of records. I need retrieve the records in the specified order for processing.

    If I try doing a dataSource.getCacheData(), the data is returned in its original order.

    If I do a grid.selectAllRecords() and then grid.getSelectedRecords(), the array of ListGridRecords returned is in the proper order that I need. However, it seems like there should be a more direct way of getting the records out of the grid.

    In going through the debugger and also by looking at the documentation, there is a data attribute on ListGrid. By accessing that attribute, I'm not quite getting what I need. However, I can do grid.data.allRows and I do get what I need. But, since I didn't see "allRows" in the documentation, I feel as though that is not the proper retrieval method.

    Is there a more direct way to get the ListGridRecords out of the ListGrid that ensures that I am getting the records in the order that it is shown in the grid?

    #2
    The "data" attribute is doc'd as a ResultSet, so just follow that link all you'll see various appropriate APIs like getRange().

    Comment


      #3
      Ah, perfect! The documentation shows that data is a List of ListGridRecord. Thanks for pointing that out about ResultSet (which implements List)! I hadn't put that together yet. :-)

      Comment


        #4
        The second sentence was the key one :)

        "When using a DataSource, rather than directly providing data, you will typically call fetchData() instead, which will automatically establish data as a ResultSet (see the fetchData() docs for details)."

        Comment


          #5
          Hahaha....guess I need to slow down a bit! :-) I am having to completely rewrite an application using a different technology stack and this product has impressed me! I'm getting things done way faster because of the sophistication of it, so thanks for that!

          Comment

          Working...
          X