restdojodgrid

Add row to start of Dgrid instead of end using Rest call


As you know, dgrid 0.4 now uses the dstore package instead of dojo's store. Using the Rest.js in dstore, I simply want to add a new row to the dgrid using a rest call. This works fine. However, it adds the row at the end (as the last row) of the dgrid. I need to add the row at the beginning (making the newly added row the first row of the dgrid). Inside Rest.js, there is a variable called defaultNewToStart which I figured would do the trick, but even when set to true, dgrid still adds the row at the end. Any advice on how to get Rest.js in dstore to add a row to the beginning of the dgrid.


Solution

  • I figured out what I did wrong. In dgrid/OnDemandGrid, I set the property "sort", which was causing the queryExecutor in Trackable.js to put the newly added row at the end instead of the beginning. So all I had to do was remove the sort property, and now it works fine.