Create new row between objects in Data grid 2

There is a list of objects in data grid 2, with a plus icon. The requirement is Upon clicking the + button new object row should be created below the current object field. Now it is creating at last below all the objects. I have tried in many different ways but after saving the object again it is displaying at the bottom of the lists   I created Ds microflow for the data source and association - clicking on the plus icon created the object and added it exactly next to the parent object in the list. It displayed as expected but after saving the page needs to refresh for another case, when this new object is saved and then it is displayed below the list. Similarly, with data source with Association is not working as expected. Please find the images attached for reference. Consider the marked 3rd March object is parent, which is saved in a database and has a plus icon. once clicking the Child object must be created below the Parent object. But if you noticed in the next screenshot, the object is created below to the 28th Apr, which is the last object in the list. So, we need to create an object in between saved objects and save the newly created object.
1 answers

Consider ading an index attribute and sort on that attribute.

When creating the new object set the index to the next value and renumber the other entries by retrieving those and setting their index to the index+1?